Skip to content

Commit

Permalink
Update testing setup
Browse files Browse the repository at this point in the history
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 reactjs#285
  • Loading branch information
claydiffrient committed Dec 31, 2016
1 parent 945919d commit 426f5e4
Show file tree
Hide file tree
Showing 10 changed files with 877 additions and 1,346 deletions.
26 changes: 14 additions & 12 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,27 @@ module.exports = function(config) {

basePath: '',

frameworks: ['mocha', 'browserify'],
frameworks: ['mocha'],

files: [
'specs/main.js'
'specs/spec_index.js'
],

exclude: [],

preprocessors: {
'specs/main.js': ['browserify']
'specs/spec_index.js': [ 'webpack', 'sourcemap' ]
},

browserify: {
transform: ['envify'],
watch: true,
debug: true
webpack: require('./webpack.test.config'),

webpackMiddleware: {
stats: 'errors-only'
},

reporters: ['progress'],
reporters: ['mocha'],

mochaReporter: {
showDiff: true
},

port: 9876,

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

autoWatch: true,

browsers: ['Chrome'],
browsers: [ (process.env.CONTINUOUS_INTEGRATION) ? 'Firefox' : 'Chrome' ],

captureTimeout: 60000,

singleRun: true
singleRun: (process.env.CONTINUOUS_INTEGRATION)
});
};
25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"example": "examples"
},
"scripts": {
"test": "scripts/test --browsers Firefox",
"test": "NODE_ENV=test karma start",
"start": "scripts/dev-examples",
"docs": "npm-run-all docs:*",
"docs-dev": "npm-run-all docs:clean docs:prepare docs:build:watch",
Expand All @@ -33,23 +33,24 @@
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"envify": "^3.4.1",
"expect": "1.10.0",
"expect": "^1.20.2",
"gitbook-cli": "^2.3.0",
"karma": "^0.13.22",
"karma-browserify": "^4.2.1",
"karma-chrome-launcher": "0.2.0",
"karma-cli": "0.1.0",
"karma-firefox-launcher": "0.1.6",
"karma-mocha": "0.2.0",
"karma-safari-launcher": "^0.1.1",
"mocha": "2.3.3",
"karma": "^1.3.0",
"karma-chrome-launcher": "2.0.0",
"karma-cli": "1.0.1",
"karma-firefox-launcher": "1.0.0",
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.1",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.8.1",
"mocha": "3.2.0",
"npm-run-all": "^3.1.2",
"react": "^15.0.0",
"react-addons-test-utils": "^15.0.0",
"react-dom": "^15.0.0",
"rf-release": "0.4.0",
"rimraf": "^2.5.4",
"sinon": "^1.17.3",
"sinon": "next",
"uglify-js": "2.4.24",
"webpack": "^1.12.14",
"webpack-dev-server": "1.11.0"
Expand All @@ -74,4 +75,4 @@
"modal",
"dialog"
]
}
}
Loading

0 comments on commit 426f5e4

Please sign in to comment.