Skip to content

Commit 426f5e4

Browse files
committed
Update testing setup
This commit does a few things: - Converts to bundling tests with webpack - Starts using `expect` for assertions - Updates the version of several testing libraries - Allows tests to be written using ES2015 and beyond closes #285
1 parent 945919d commit 426f5e4

10 files changed

+877
-1346
lines changed

karma.conf.js

+14-12
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,27 @@ module.exports = function(config) {
33

44
basePath: '',
55

6-
frameworks: ['mocha', 'browserify'],
6+
frameworks: ['mocha'],
77

88
files: [
9-
'specs/main.js'
9+
'specs/spec_index.js'
1010
],
1111

12-
exclude: [],
13-
1412
preprocessors: {
15-
'specs/main.js': ['browserify']
13+
'specs/spec_index.js': [ 'webpack', 'sourcemap' ]
1614
},
1715

18-
browserify: {
19-
transform: ['envify'],
20-
watch: true,
21-
debug: true
16+
webpack: require('./webpack.test.config'),
17+
18+
webpackMiddleware: {
19+
stats: 'errors-only'
2220
},
2321

24-
reporters: ['progress'],
22+
reporters: ['mocha'],
23+
24+
mochaReporter: {
25+
showDiff: true
26+
},
2527

2628
port: 9876,
2729

@@ -31,10 +33,10 @@ module.exports = function(config) {
3133

3234
autoWatch: true,
3335

34-
browsers: ['Chrome'],
36+
browsers: [ (process.env.CONTINUOUS_INTEGRATION) ? 'Firefox' : 'Chrome' ],
3537

3638
captureTimeout: 60000,
3739

38-
singleRun: true
40+
singleRun: (process.env.CONTINUOUS_INTEGRATION)
3941
});
4042
};

package.json

+13-12
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"example": "examples"
1414
},
1515
"scripts": {
16-
"test": "scripts/test --browsers Firefox",
16+
"test": "NODE_ENV=test karma start",
1717
"start": "scripts/dev-examples",
1818
"docs": "npm-run-all docs:*",
1919
"docs-dev": "npm-run-all docs:clean docs:prepare docs:build:watch",
@@ -33,23 +33,24 @@
3333
"babel-preset-es2015": "^6.6.0",
3434
"babel-preset-react": "^6.5.0",
3535
"envify": "^3.4.1",
36-
"expect": "1.10.0",
36+
"expect": "^1.20.2",
3737
"gitbook-cli": "^2.3.0",
38-
"karma": "^0.13.22",
39-
"karma-browserify": "^4.2.1",
40-
"karma-chrome-launcher": "0.2.0",
41-
"karma-cli": "0.1.0",
42-
"karma-firefox-launcher": "0.1.6",
43-
"karma-mocha": "0.2.0",
44-
"karma-safari-launcher": "^0.1.1",
45-
"mocha": "2.3.3",
38+
"karma": "^1.3.0",
39+
"karma-chrome-launcher": "2.0.0",
40+
"karma-cli": "1.0.1",
41+
"karma-firefox-launcher": "1.0.0",
42+
"karma-mocha": "^1.3.0",
43+
"karma-mocha-reporter": "^2.2.1",
44+
"karma-sourcemap-loader": "^0.3.7",
45+
"karma-webpack": "^1.8.1",
46+
"mocha": "3.2.0",
4647
"npm-run-all": "^3.1.2",
4748
"react": "^15.0.0",
4849
"react-addons-test-utils": "^15.0.0",
4950
"react-dom": "^15.0.0",
5051
"rf-release": "0.4.0",
5152
"rimraf": "^2.5.4",
52-
"sinon": "^1.17.3",
53+
"sinon": "next",
5354
"uglify-js": "2.4.24",
5455
"webpack": "^1.12.14",
5556
"webpack-dev-server": "1.11.0"
@@ -74,4 +75,4 @@
7475
"modal",
7576
"dialog"
7677
]
77-
}
78+
}

0 commit comments

Comments
 (0)