Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !378

Tweak Jest default settings

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge jest-tweaks into master 8 years ago
  • Overview 1
  • Commits 1
  • Pipelines 0
  • Changes 3

Created by: gaearon

Disable timer mocking and enable verbose output. This makes my Mocha tests from another projects pass, and makes the output more obvious.

Compare
  • master (base)

and
  • latest version
    048715e2
    1 commit, 2 years ago

3 files
+ 11
- 1

    Preferences

    File browser
    Compare changes
confi‎g/jest‎
environ‎ment.js‎ +7 -0
scr‎ipts‎
ut‎ils‎
createJes‎tConfig.js‎ +3 -1
ejec‎t.js‎ +1 -0
config/jest/environment.js 0 → 100644
+ 7
- 0
  • View file @ 048715e2

  • Edit in single-file editor

  • Open in Web IDE

// Currently, Jest mocks setTimeout() and similar functions by default:
// https://facebook.github.io/jest/docs/timer-mocks.html
// We think this is confusing, so we disable this feature.
// If you see value in it, run `jest.useFakeTimers()` in individual tests.
beforeEach(() => {
jest.useRealTimers();
});
scripts/utils/createJestConfig.js
+ 3
- 1
  • View file @ 048715e2

  • Edit in single-file editor

  • Open in Web IDE


@@ -19,7 +19,9 @@ module.exports = (resolve, rootDir) => {
setupFiles: [
resolve('config/polyfills.js')
],
testEnvironment: 'node'
setupTestFrameworkScriptFile: resolve('config/jest/environment.js'),
testEnvironment: 'node',
verbose: true
};
if (rootDir) {
config.rootDir = rootDir;
scripts/eject.js
+ 1
- 0
  • View file @ 048715e2

  • Edit in single-file editor

  • Open in Web IDE


@@ -41,6 +41,7 @@ prompt(
path.join('config', 'webpack.config.prod.js'),
path.join('config', 'jest', 'CSSStub.js'),
path.join('config', 'jest', 'FileStub.js'),
path.join('config', 'jest', 'environment.js'),
path.join('config', 'jest', 'transform.js'),
path.join('scripts', 'build.js'),
path.join('scripts', 'start.js'),
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
1
CLA Signed
1
CLA Signed
    Assign labels
  • Manage project labels

Milestone
0.3.0
0.3.0
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
1
1 participant
Administrator
Reference: facebook/create-react-app!378
Source branch: jest-tweaks

Menu

Explore Projects Groups Snippets