Skip to content

Commit

Permalink
initial work on testing with karma
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuno Campos committed Sep 13, 2016
1 parent 05169e7 commit f81b971
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
53 changes: 53 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
var webpack = require('webpack'); // eslint-disable-line no-var

module.exports = function karma(config) {
config.set({
plugins: [
'karma-chrome-launcher',
'karma-mocha',
'karma-webpack',
],
basePath: '.',
frameworks: ['mocha'],
files: [
'test/*.js',
],
exclude: [
'test/_*.js',
],
browsers: [
'Chrome',
],
preprocessors: {
'test/*.js': ['webpack'],
},
webpack: {
resolve: {
extensions: ['', '.js', '.jsx', '.json'],
alias: {
sinon: 'sinon/pkg/sinon',
},
},
module: {
noParse: [
/node_modules\/sinon\//,
],
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.json$/,
loader: 'json-loader',
},
],
},
plugins: [
new webpack.IgnorePlugin(/react\/lib\/ReactContext/),
new webpack.IgnorePlugin(/react\/lib\/ExecutionEnvironment/),
],
},
});
};
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"test:only": "mocha --recursive test --reporter dot",
"test:single": "mocha --watch --reporter dot",
"test:watch": "mocha --recursive test --watch --reporter dot",
"test:karma": "karma start",
"test:env": "sh ./example-test.sh",
"test:all": "npm run react:13 && npm run test:only && npm run react:14 && npm run test:only && npm run react:15 && npm run test:only",
"react:clean": "rimraf node_modules/react node_modules/react-dom node_modules/react-addons-test-utils",
Expand Down Expand Up @@ -79,9 +80,15 @@
"gitbook-cli": "^1.0.1",
"istanbul": "^1.0.0-alpha.2",
"jsdom": "^6.1.0",
"json-loader": "^0.5.4",
"karma": "^0.13.22",
"karma-chrome-launcher": "^1.0.1",
"karma-mocha": "^1.0.1",
"karma-webpack": "^1.7.0",
"mocha": "^3.0.2",
"rimraf": "^2.5.4",
"sinon": "^1.17.5"
"sinon": "^1.17.5",
"webpack": "^1.13.1"
},
"peerDependencies": {
"react": "0.13.x || 0.14.x || ^15.0.0-0 || 15.x"
Expand Down

0 comments on commit f81b971

Please sign in to comment.