gruntjs / gruntjs/grunt-contrib-nodeunit

error while running same grunt nodeunit task twice

Open
#50 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
70
Forks
25
PR merge metrics
No merged PRs in 30d

Description

I want to run same nodeunit test twice but it gives me error "Fatal error: test after end() was called"

For example:

Setup

nodeunit:{
src: ['test.js'],
options: {
reporter: 'tap'
}
}
grunt.registerTask('test', 'Run unit test', function (context) {
process.env.TEST = "TEST1";
grunt.task.run('nodeunit');
// change the environment variable
process.env.TEST = "TEST2";
grunt.task.run("nodeunit");
});

test.js

exports.test = {
setUp: function (callback) {
callback();
},
tearDown: function (callback) {
callback();
},
"test 1": function (test) {
test.equal(doSomething(process.env.TEST), true, "should pass with env var:" + process.env.TEST);
test.done();
}
};

Error while running second `grunt.task.run`
> Fatal error: test after end() was called

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.