This is a simple mocha environment that runs all specs in the /specs
folder. Each file is transpiled from ES2015
+ some ES2016
to ES5
using babel. An ES2015
polyfill is also provided using babel-polyfill.
The specs:watch
task below re-triggers the test run only when an existing spec file is modified.
> npm run specs
> npm run specs:watch
The test environment tries to mimic the browser using jsdom. This means that you can even run your react component specs here! Just remember to install the react babel preset.
All the expectations are handled by chai. chai.expect
is available as global.expect
in all specs. Object.prototype.should
is also set up in the spec configuration via chai.should()
. Lastly, chai
is also configured to use the popular chai-as-promised library. sinon is simply installed as a convenience.
Just for convenience, a sample .eslintrc
file is provided. eslint is installed and uses babel-eslint as its parser. Now your spec files can look beautiful! To run the linter:
> npm run lint