Configuring Jest Test framework with webpack 4 and Babel 7
This commit is contained in:
parent
802587fd70
commit
2597b4bb2a
|
@ -0,0 +1 @@
|
|||
import '@babel/polyfill';
|
File diff suppressed because it is too large
Load Diff
34
package.json
34
package.json
|
@ -40,6 +40,7 @@
|
|||
"fs-extra": "^5.0.0",
|
||||
"html-loader": "^0.5.5",
|
||||
"html-webpack-plugin": "^3.0.4",
|
||||
"jest": "^22.4.2",
|
||||
"json-loader": "^0.5.7",
|
||||
"postcss-loader": "^2.1.1",
|
||||
"postcss-simple-vars": "^4.1.0",
|
||||
|
@ -62,5 +63,38 @@
|
|||
"material-ui": "^1.0.0-beta.35",
|
||||
"material-ui-icons": "^1.0.0-beta.35",
|
||||
"react-final-form": "^3.1.2"
|
||||
},
|
||||
"jest": {
|
||||
"collectCoverageFrom": [
|
||||
"src/**/*.{js,jsx}"
|
||||
],
|
||||
"setupFiles": [
|
||||
"<rootDir>/config/webpack.config.test.js",
|
||||
"<rootDir>/config/polyfills.js"
|
||||
],
|
||||
"testMatch": [
|
||||
"<rootDir>/src/**/__tests__/**/*.js?(x)",
|
||||
"<rootDir>/src/**/?(*.)(spec|test).js?(x)"
|
||||
],
|
||||
"testEnvironment": "node",
|
||||
"testURL": "http://localhost",
|
||||
"transform": {
|
||||
"^.+\\.(js|jsx)$": "<rootDir>/node_modules/babel-jest",
|
||||
"^.+\\.(css|scss)$": "<rootDir>/config/jest/cssTransform.js",
|
||||
"^(?!.*\\.(js|jsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
|
||||
},
|
||||
"transformIgnorePatterns": [
|
||||
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"
|
||||
],
|
||||
"moduleNameMapper": {
|
||||
"^react-native$": "react-native-web"
|
||||
},
|
||||
"moduleFileExtensions": [
|
||||
"web.js",
|
||||
"js",
|
||||
"json",
|
||||
"web.jsx",
|
||||
"jsx"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,17 +15,4 @@ if (!process.env.CI && argv.indexOf('--coverage') < 0) {
|
|||
argv.push('--watch');
|
||||
}
|
||||
|
||||
// A temporary hack to clear terminal correctly.
|
||||
// You can remove this after updating to Jest 18 when it's out.
|
||||
// https://github.com/facebook/jest/pull/2230
|
||||
var realWrite = process.stdout.write;
|
||||
var CLEAR = process.platform === 'win32' ? '\x1Bc' : '\x1B[2J\x1B[3J\x1B[H';
|
||||
process.stdout.write = function(chunk, encoding, callback) {
|
||||
if (chunk === '\x1B[2J\x1B[H') {
|
||||
chunk = CLEAR;
|
||||
}
|
||||
return realWrite.call(this, chunk, encoding, callback);
|
||||
};
|
||||
|
||||
|
||||
jest.run(argv);
|
||||
|
|
Loading…
Reference in New Issue