Skip to content

error while running same grunt nodeunit task twice #50

Description

@sameercaresu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions