mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-01 09:01:04 +08:00
Tweak Jest default settings (#378)
Disable timer mocking and enable verbose output.
This commit is contained in:
7
config/jest/environment.js
Normal file
7
config/jest/environment.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// 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();
|
||||
});
|
||||
@@ -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'),
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user