Permalink
Browse files

FIxes new test stack configuration

1. NPM testunit was not loading all the files as bash expansion was kicking in before mocha could get the glob pattern
2. The td.reset() method was not being called before each tests both in Wallby and on the command line
  • Loading branch information...
samhatoum committed Jan 11, 2017
1 parent 2aee61d commit 34f363ad9590854e48b4d94d523a7c15e76465ab
Showing with 8 additions and 5 deletions.
  1. +5 −2 mocha-setup.js
  2. +1 −1 mocha.opts
  3. +1 −1 package.json
  4. +1 −1 wallaby-mocha.js
View
@@ -7,6 +7,9 @@
const td = require('testdouble');
const quibble = require('quibble');
global.td = td;
- td.reset();
- quibble.ignoreCallsFromThisFile(require.main.filename);
+
+ beforeEach(() => {
+ td.reset();
+ quibble.ignoreCallsFromThisFile(require.main.filename);
+ });
})();
View
@@ -1,4 +1,4 @@
---require mocha-setup
--compilers js:babel-core/register
--reporter spec
--ui bdd
+mocha-setup.js
View
@@ -34,7 +34,7 @@
"lintfix": "eslint ./src --fix",
"start": "node ./scripts/run.js",
"testonly": "npm run testunit && npm run prepublish && node ./scripts/run-tests.js",
- "testunit": "mocha --opts ./mocha.opts `node -e \"console.log(require('./package.json').mocha.tests.join(' '))\"`",
+ "testunit": "mocha --opts ./mocha.opts \"`node -e \"console.log(require('./package.json').mocha.tests.join(' '))\"`\"",
"test": "npm run lint && npm run testonly",
"publish-patch": "npm version patch; npm publish; git push; git push --tags",
"publish-minor": "npm version minor; npm publish; git push; git push --tags",
View
@@ -10,7 +10,7 @@ module.exports = (wallaby) => {
env: {type: 'node'},
workers: {initial: 1, regular: 1, recycle: true},
setup: () => {
- require(`${wallaby.localProjectDir}/mocha-setup`);
+ wallaby.testFramework.addFile(`${wallaby.localProjectDir}/mocha-setup.js`);
},
}
};

0 comments on commit 34f363a

Please sign in to comment.