Skip to content
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.

Add force option #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -52,6 +52,12 @@ grunt.registerTask('default', 'simplemocha');

Now, you can just run `grunt simplemocha` in your shell to run the tests. That's it!

## Options
The ```force``` option specifies that the task should report success, even if tests fail.
This is useful if you are using watch to continuously run your tests.

The other options are passed to mocha directly.

## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding
style. Add unit tests for any new or changed functionality. Lint and test your
Expand Down
7 changes: 5 additions & 2 deletions tasks/simple-mocha.js
Expand Up @@ -15,7 +15,10 @@ module.exports = function(grunt) {
grunt.registerMultiTask('simplemocha', 'Run tests with mocha', function() {

var options = this.options(),
mocha_instance = new Mocha(options);
mocha_instance = new Mocha(options),
force = options.force;

options.force = undefined;

this.filesSrc.forEach(mocha_instance.addFile.bind(mocha_instance));

Expand All @@ -27,7 +30,7 @@ module.exports = function(grunt) {
var done = this.async();

mocha_instance.run(function(errCount) {
var withoutErrors = (errCount === 0);
var withoutErrors = force || (errCount === 0);
done(withoutErrors);
});
});
Expand Down