vistaprint / grunt-js-test

Grunt plugin to run client-side, mocha unit tests and generate code coverage reports
10 stars 11 forks source link

Mocha, Sinon and Chai as npm modules #17

Closed benhutchins closed 9 years ago

benhutchins commented 9 years ago

Use Mocha, Sinon and Chai as npm modules instead of including them in views/deps

This was partially done in PR https://github.com/vistaprint/grunt-js-test/pull/15 however Mocha was still using views/deps/mocha.css and didn't work if mocha was installed globally via npm install -g mocha which may be done if someone wanted to use the mocha CLI.

Using require.resolve to create a static file handler for each (Mocha, Chai and Sinon). Then include them through that from the jade templates. Also have new options to explicitly disable Chai or Sinon, although currently Chai will cause some warnings if excluded because it's expected by views/deps/shared.js.

Also partially tackles #2

benhutchins commented 9 years ago

I tested using peerDependencies, however this will only work if a project includes both grunt-js-test and chai itself. That would probably be ideal, but will require Chai and Sinon to not be expected by default.

benhutchins commented 9 years ago

Chai is still required by all the example projects, should probably rewrite those to just use Mocha's built in assert libraries and then make Chai optional. It'd be best if the deps option for the js-test grunt task could someone also be used to include Chai, Sinon or other similar libraries.