Permalink
Browse files

Added test runners setup

  • Loading branch information...
1 parent a277e95 commit 1b361771894e88135aa1a5294e20977a02b4575c @okonet committed Apr 16, 2016
Showing with 59 additions and 2 deletions.
  1. +7 −0 .babelrc
  2. +7 −2 package.json
  3. +19 −0 testSetup.js
  4. +26 −0 wallaby.config.js
View
@@ -0,0 +1,7 @@
+{
+ "presets": [
+ "react",
+ "es2015",
+ "stage-1"
+ ]
+}
View
@@ -9,7 +9,7 @@
"lint": "eslint ./src",
"lint:fix": "eslint --fix ./src",
"prepublish": "npm run lint && npm run clean && npm run build",
- "test": "NODE_ENV=test mocha --compilers js:babel/register --recursive",
+ "test": "mocha --compilers js:babel-core/register --require testSetup.js --recursive ./tests/*.js",
"test:watch": "npm test -- --watch",
"eslint-staged": "eslint-staged"
},
@@ -56,14 +56,19 @@
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-1": "^6.5.0",
+ "chai": "^3.5.0",
+ "chai-enzyme": "^0.4.1",
+ "enzyme": "^2.2.0",
"eslint": "^2.5.3",
"eslint-config-wildbit": "^2.0.0",
"eslint-plugin-import": "^1.4.0",
"lint-staged": "^0.1.1",
"mocha": "^2.4.5",
"pre-commit": "^1.1.2",
"react": "^0.14.8",
+ "react-addons-test-utils": "^15.0.0",
"react-dom": "^0.14.8",
- "rimraf": "^2.5.2"
+ "rimraf": "^2.5.2",
+ "sinon": "^1.17.3"
}
}
View
@@ -0,0 +1,19 @@
+var jsdom = require('jsdom').jsdom
+var chai = require('chai')
+var chaiEnzyme = require('chai-enzyme')
+chai.use(chaiEnzyme())
+
+var exposedProperties = ['window', 'navigator', 'document'];
+
+global.document = jsdom('');
+global.window = document.defaultView;
+Object.keys(document.defaultView).forEach((property) => {
+ if (typeof global[property] === 'undefined') {
+ exposedProperties.push(property);
+ global[property] = document.defaultView[property];
+ }
+});
+
+global.navigator = {
+ userAgent: 'node.js'
+};
View
@@ -0,0 +1,26 @@
+module.exports = function (wallaby) {
+ return {
+ files: [
+ 'testSetup.js',
+ 'src/*.js'
+ ],
+
+ tests: ['tests/*.js'],
+
+ env: {
+ type: 'node',
+ runner: 'node'
+ },
+
+ compilers: {
+ '**/*.js': wallaby.compilers.babel()
+ },
+
+ testFramework: 'mocha',
+
+ bootstrap: function bootstrap() {
+ require('./testSetup')
+ }
+
+ }
+}

0 comments on commit 1b36177

Please sign in to comment.