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",
|
"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": [
|
"keywords": [
|
||||||
"netlify",
|
"netlify",
|
||||||
"cms"
|
"cms"
|
||||||
@ -56,6 +63,7 @@
|
|||||||
"expect": "^1.20.2",
|
"expect": "^1.20.2",
|
||||||
"exports-loader": "^0.6.3",
|
"exports-loader": "^0.6.3",
|
||||||
"file-loader": "^0.8.5",
|
"file-loader": "^0.8.5",
|
||||||
|
"identity-obj-proxy": "^3.0.0",
|
||||||
"imports-loader": "^0.6.5",
|
"imports-loader": "^0.6.5",
|
||||||
"jest-cli": "^15.1.1",
|
"jest-cli": "^15.1.1",
|
||||||
"lint-staged": "^3.0.3",
|
"lint-staged": "^3.0.3",
|
||||||
@ -65,6 +73,7 @@
|
|||||||
"postcss-import": "^8.1.2",
|
"postcss-import": "^8.1.2",
|
||||||
"postcss-loader": "^0.9.1",
|
"postcss-loader": "^0.9.1",
|
||||||
"pre-commit": "^1.1.3",
|
"pre-commit": "^1.1.3",
|
||||||
|
"react-addons-test-utils": "^15.3.2",
|
||||||
"sass-loader": "^4.0.2",
|
"sass-loader": "^4.0.2",
|
||||||
"style-loader": "^0.13.0",
|
"style-loader": "^0.13.0",
|
||||||
"stylefmt": "^4.3.1",
|
"stylefmt": "^4.3.1",
|
||||||
@ -84,8 +93,8 @@
|
|||||||
"bricks.js": "^1.7.0",
|
"bricks.js": "^1.7.0",
|
||||||
"dateformat": "^1.0.12",
|
"dateformat": "^1.0.12",
|
||||||
"fuzzy": "^0.1.1",
|
"fuzzy": "^0.1.1",
|
||||||
"immutable": "^3.7.6",
|
|
||||||
"immutability-helper": "^2.0.0",
|
"immutability-helper": "^2.0.0",
|
||||||
|
"immutable": "^3.7.6",
|
||||||
"js-base64": "^2.1.9",
|
"js-base64": "^2.1.9",
|
||||||
"js-yaml": "^3.5.3",
|
"js-yaml": "^3.5.3",
|
||||||
"json-loader": "^0.5.4",
|
"json-loader": "^0.5.4",
|
||||||
@ -98,20 +107,20 @@
|
|||||||
"pluralize": "^3.0.0",
|
"pluralize": "^3.0.0",
|
||||||
"prismjs": "^1.5.1",
|
"prismjs": "^1.5.1",
|
||||||
"react": "^15.1.0",
|
"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-addons-css-transition-group": "^15.3.1",
|
||||||
"react-datetime": "^2.6.0",
|
"react-datetime": "^2.6.0",
|
||||||
"react-portal": "^2.2.1",
|
"react-dom": "^15.1.0",
|
||||||
"react-simple-dnd": "^0.1.2",
|
"react-hot-loader": "^3.0.0-beta.2",
|
||||||
"react-toolbox": "^1.2.1",
|
|
||||||
"react-waypoint": "^3.1.3",
|
|
||||||
"react-immutable-proptypes": "^1.6.0",
|
"react-immutable-proptypes": "^1.6.0",
|
||||||
"react-lazy-load": "^3.0.3",
|
"react-lazy-load": "^3.0.3",
|
||||||
|
"react-portal": "^2.2.1",
|
||||||
"react-pure-render": "^1.0.2",
|
"react-pure-render": "^1.0.2",
|
||||||
"react-redux": "^4.4.0",
|
"react-redux": "^4.4.0",
|
||||||
"react-router": "^2.5.1",
|
"react-router": "^2.5.1",
|
||||||
"react-router-redux": "^4.0.5",
|
"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": "^3.3.1",
|
||||||
"redux-thunk": "^1.0.3",
|
"redux-thunk": "^1.0.3",
|
||||||
"selection-position": "^1.0.0",
|
"selection-position": "^1.0.0",
|
||||||
|
@ -1,24 +1,40 @@
|
|||||||
|
/* eslint global-require: 0 */
|
||||||
|
/* eslint import/no-extraneous-dependencies: 0 */
|
||||||
|
|
||||||
process.env.BABEL_ENV = 'test';
|
process.env.BABEL_ENV = 'test';
|
||||||
|
|
||||||
module.exports = wallaby => ({
|
module.exports = wallaby => ({
|
||||||
files: [
|
files: [
|
||||||
{ pattern: 'src/**/*.js' },
|
'package.json',
|
||||||
{ pattern: 'src/**/*.js.snap' },
|
'src/**/*.js',
|
||||||
{ pattern: 'src/**/*.spec.js', ignore: true }
|
'src/**/*.js.snap',
|
||||||
|
'!src/**/*.spec.js',
|
||||||
],
|
],
|
||||||
|
|
||||||
tests: [
|
tests: ['src/**/*.spec.js'],
|
||||||
{ pattern: 'src/**/*.spec.js' }
|
|
||||||
],
|
|
||||||
|
|
||||||
compilers: {
|
compilers: {
|
||||||
'src/**/*.js': wallaby.compilers.babel()
|
'src/**/*.js': wallaby.compilers.babel(),
|
||||||
},
|
},
|
||||||
|
|
||||||
env: {
|
env: {
|
||||||
type: 'node',
|
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