Skip to content

Commit

Permalink
Install Jest and Enzyme (#54)
Browse files Browse the repository at this point in the history
* Install Jest and Enzyme and remove Mocha and Chai.

Update node-sass version.

* Tentative jest configuration.

* Get Jest config in shape.

Removed unneeded extensions from webpack defaults.

Remove obsolete test config.
  • Loading branch information
normangilmore authored Feb 3, 2017
1 parent e1e8524 commit c21722d
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 57 deletions.
3 changes: 3 additions & 0 deletions __mocks__/fileMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// __mocks__/fileMock.js

module.exports = 'test-file-stub';
30 changes: 23 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"build": "NODE_ENV=development WEBPACK=cleandist webpack --progress --stats --config webpack.config.js",
"build:watch": "NODE_ENV=development WEBPACK=cleandist webpack --progress --stats --config webpack.config.js --watch",
"deploy": "NODE_ENV=production WEBPACK=cleandist webpack --progress --stats --config webpack.config.js",
"test": "mocha --compilers js:babel-core/register --require ./test/test_helper.js --recursive",
"test": "node --harmony_proxies node_modules/.bin/jest",
"test:watch": "npm run test -- --watch",
"tasks:highlighter": "curl http://localhost:5000/api/highlighter_tasks/?format=json | python -m json.tool > pbs-highlighter/highlighter_tasks.json",
"tasks:quiz": "curl http://localhost:5000/api/quiz_tasks/?format=json | python -m json.tool > pbs-quiz/quiz_tasks.json"
Expand All @@ -24,6 +24,7 @@
"autoprefixer-loader": "^3.2.0",
"babel-core": "^6.4.5",
"babel-eslint": "^7.1.0",
"babel-jest": "^18.0.0",
"babel-loader": "^6.2.1",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-class-properties": "^6.19.0",
Expand All @@ -38,8 +39,6 @@
"babel-register": "^6.16.3",
"babel-require": "^1.0.1",
"babel-runtime": "^6.3.19",
"chai": "^3.5.0",
"chai-immutable": "^1.5.3",
"colors": "^1.1.2",
"css-loader": "^0.26.0",
"csswring": "^5.1.0",
Expand All @@ -49,6 +48,7 @@
"eslint": "^3.10.2",
"eslint-config-airbnb": "^13.0.0",
"eslint-loader": "^1.6.1",
"eslint-module-utils": "^2.0.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-react": "^6.7.1",
Expand All @@ -58,13 +58,13 @@
"file-loader": "^0.9.0",
"fs-extra": "^1.0.0",
"html-webpack-plugin": "^2.22.0",
"identity-obj-proxy": "^3.0.0",
"immutable": "^3.8.1",
"imports-loader": "^0.6.3",
"jest": "^18.1.0",
"json-loader": "^0.5.1",
"mocha": "^3.0.2",
"mocha-webpack": "^0.7.0",
"moment": "^2.15.2",
"node-sass": "^3.0.0-beta.7",
"node-sass": "^4.4.0",
"normalizr": "^2.3.1",
"on-build-webpack": "^0.1.0",
"postcss-loader": "^1.1.1",
Expand All @@ -73,12 +73,14 @@
"react": "^15.4.0",
"react-addons-css-transition-group": "^15.4.0",
"react-addons-shallow-compare": "^15.4.0",
"react-addons-test-utils": "^15.4.2",
"react-dates": "^4.0.0",
"react-dom": "^15.4.0",
"react-hot-loader": "^3.0.0-beta.6",
"react-portal": "^3.0.0",
"react-redux": "^4.2.1",
"react-router": "^3.0.0",
"react-test-renderer": "^15.4.2",
"redux": "^3.2.1",
"redux-devtools": "^3.1.0",
"redux-thunk": "^2.1.0",
Expand All @@ -89,5 +91,19 @@
"webpack": "^1.12.2",
"webpack-dev-server": "^1.12.0"
},
"dependencies": {}
"dependencies": {},
"jest": {
"verbose": true,
"modulePaths": [
"<rootDir>/app",
"<rootDir>/vendor/bower_components"
],
"moduleFileExtensions": ["", "js", "jsx"],
"moduleDirectories": ["node_modules", "web_modules"],
"moduleNameMapper": {
"^modernizr$": "<rootDir>/vendor/bower_components/modernizr/modernizr.js",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|scss)$": "identity-obj-proxy"
}
}
}
19 changes: 0 additions & 19 deletions test/index.html

This file was deleted.

10 changes: 0 additions & 10 deletions test/test_chai.js

This file was deleted.

4 changes: 0 additions & 4 deletions test/test_helper.js

This file was deleted.

15 changes: 0 additions & 15 deletions testem.json

This file was deleted.

10 changes: 8 additions & 2 deletions webpack/base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default {
},
root: [PATHS.app, PATHS.bowerPath],
modulesDirectories: ['node_modules', 'web_modules'],
extensions: ['', '.js', '.scss', 'hbs', 'tmpl', 'svg', 'woff', 'eot', 'svg', 'png']
extensions: ['', '.js', '.jsx']
},
output: {
path: PATHS.dist,
Expand Down Expand Up @@ -151,5 +151,11 @@ export default {
// new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin()
],
noParse: [/node_modules/, new RegExp(PATHS.bowerPath)]
noParse: [/node_modules/, new RegExp(PATHS.bowerPath)],
externals: {
'cheerio': 'window',
'react/addons': true,
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true
}
};

0 comments on commit c21722d

Please sign in to comment.