Skip to content

Commit

Permalink
FIxes new test stack configuration
Browse files Browse the repository at this point in the history
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 34f363a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions mocha-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
})();
2 changes: 1 addition & 1 deletion mocha.opts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--require mocha-setup
--compilers js:babel-core/register
--reporter spec
--ui bdd
mocha-setup.js
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion wallaby-mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.