Updated Jest config to work with webpack and CSS-modules
This commit is contained in:
parent
190aa05d68
commit
fee2d8e731
3
__mocks__/fileLoaderMock.js
Normal file
3
__mocks__/fileLoaderMock.js
Normal file
@ -0,0 +1,3 @@
|
||||
// See http://facebook.github.io/jest/docs/tutorial-webpack.html#content
|
||||
|
||||
module.exports = 'test-file-stub';
|
3
__mocks__/styleLoaderMock.js
Normal file
3
__mocks__/styleLoaderMock.js
Normal file
@ -0,0 +1,3 @@
|
||||
// See http://facebook.github.io/jest/docs/tutorial-webpack.html#content
|
||||
|
||||
module.exports = {};
|
23
package.json
23
package.json
@ -31,6 +31,13 @@
|
||||
]
|
||||
},
|
||||
"pre-commit": "lint:staged",
|
||||
"jest": {
|
||||
"moduleNameMapper": {
|
||||
"^.+\\.(png|eot|woff|woff2|ttf|svg|gif)$": "<rootDir>/__mocks__/fileLoaderMock.js",
|
||||
"^.+\\.scss$": "<rootDir>/__mocks__/styleLoaderMock.js",
|
||||
"^.+\\.css$": "identity-obj-proxy"
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
"netlify",
|
||||
"cms"
|
||||
@ -56,6 +63,7 @@
|
||||
"expect": "^1.20.2",
|
||||
"exports-loader": "^0.6.3",
|
||||
"file-loader": "^0.8.5",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
"imports-loader": "^0.6.5",
|
||||
"jest-cli": "^15.1.1",
|
||||
"lint-staged": "^3.0.3",
|
||||
@ -65,6 +73,7 @@
|
||||
"postcss-import": "^8.1.2",
|
||||
"postcss-loader": "^0.9.1",
|
||||
"pre-commit": "^1.1.3",
|
||||
"react-addons-test-utils": "^15.3.2",
|
||||
"sass-loader": "^4.0.2",
|
||||
"style-loader": "^0.13.0",
|
||||
"stylefmt": "^4.3.1",
|
||||
@ -84,8 +93,8 @@
|
||||
"bricks.js": "^1.7.0",
|
||||
"dateformat": "^1.0.12",
|
||||
"fuzzy": "^0.1.1",
|
||||
"immutable": "^3.7.6",
|
||||
"immutability-helper": "^2.0.0",
|
||||
"immutable": "^3.7.6",
|
||||
"js-base64": "^2.1.9",
|
||||
"js-yaml": "^3.5.3",
|
||||
"json-loader": "^0.5.4",
|
||||
@ -98,20 +107,20 @@
|
||||
"pluralize": "^3.0.0",
|
||||
"prismjs": "^1.5.1",
|
||||
"react": "^15.1.0",
|
||||
"react-dom": "^15.1.0",
|
||||
"react-hot-loader": "^3.0.0-beta.2",
|
||||
"react-addons-css-transition-group": "^15.3.1",
|
||||
"react-datetime": "^2.6.0",
|
||||
"react-portal": "^2.2.1",
|
||||
"react-simple-dnd": "^0.1.2",
|
||||
"react-toolbox": "^1.2.1",
|
||||
"react-waypoint": "^3.1.3",
|
||||
"react-dom": "^15.1.0",
|
||||
"react-hot-loader": "^3.0.0-beta.2",
|
||||
"react-immutable-proptypes": "^1.6.0",
|
||||
"react-lazy-load": "^3.0.3",
|
||||
"react-portal": "^2.2.1",
|
||||
"react-pure-render": "^1.0.2",
|
||||
"react-redux": "^4.4.0",
|
||||
"react-router": "^2.5.1",
|
||||
"react-router-redux": "^4.0.5",
|
||||
"react-simple-dnd": "^0.1.2",
|
||||
"react-toolbox": "^1.2.1",
|
||||
"react-waypoint": "^3.1.3",
|
||||
"redux": "^3.3.1",
|
||||
"redux-thunk": "^1.0.3",
|
||||
"selection-position": "^1.0.0",
|
||||
|
@ -1,24 +1,40 @@
|
||||
/* eslint global-require: 0 */
|
||||
/* eslint import/no-extraneous-dependencies: 0 */
|
||||
|
||||
process.env.BABEL_ENV = 'test';
|
||||
|
||||
module.exports = wallaby => ({
|
||||
files: [
|
||||
{ pattern: 'src/**/*.js' },
|
||||
{ pattern: 'src/**/*.js.snap' },
|
||||
{ pattern: 'src/**/*.spec.js', ignore: true }
|
||||
'package.json',
|
||||
'src/**/*.js',
|
||||
'src/**/*.js.snap',
|
||||
'!src/**/*.spec.js',
|
||||
],
|
||||
|
||||
tests: [
|
||||
{ pattern: 'src/**/*.spec.js' }
|
||||
],
|
||||
tests: ['src/**/*.spec.js'],
|
||||
|
||||
compilers: {
|
||||
'src/**/*.js': wallaby.compilers.babel()
|
||||
'src/**/*.js': wallaby.compilers.babel(),
|
||||
},
|
||||
|
||||
env: {
|
||||
type: 'node',
|
||||
runner: 'node'
|
||||
runner: 'node',
|
||||
params: {
|
||||
runner: '--harmony_proxies',
|
||||
},
|
||||
},
|
||||
|
||||
testFramework: 'jest',
|
||||
|
||||
setup: () => {
|
||||
wallaby.testFramework.configure({
|
||||
moduleNameMapper: {
|
||||
'^.+\\.(png|eot|woff|woff2|ttf|svg|gif)$': require('path').join(wallaby.localProjectDir, '__mocks__', 'fileLoaderMock.js'),
|
||||
'^.+\\.scss$': require('path').join(wallaby.localProjectDir, '__mocks__', 'styleLoaderMock.js'),
|
||||
'^.+\\.css$': require('identity-obj-proxy'),
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
testFramework: 'jest'
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user