diff --git a/lib/types.js b/lib/types.js index 2cdd1efc8..f7680cb94 100644 --- a/lib/types.js +++ b/lib/types.js @@ -116,6 +116,7 @@ exports.test = function (name, start, options, callback) { }); var test = { + name: name, done: function (err) { if (expecting !== undefined && expecting !== a_list.length) { var e = new Error( diff --git a/test/test-runtest.js b/test/test-runtest.js index 8fc3d5209..9ed8ad635 100644 --- a/test/test-runtest.js +++ b/test/test-runtest.js @@ -5,6 +5,7 @@ */ var nodeunit = require('../lib/nodeunit'); // @REMOVE_LINE_FOR_BROWSER +var expectedName = 'testArgs'; exports.testArgs = function (test) { @@ -13,15 +14,19 @@ exports.testArgs = function (test) { test.ok(test.ok instanceof Function, 'test.ok'); test.ok(test.same instanceof Function, 'test.same'); test.ok(test.equals instanceof Function, 'test.equals'); + test.equals(test.name, expectedName); test.done(); }; exports.testDoneCallback = function (test) { test.expect(4); - nodeunit.runTest('testname', exports.testArgs, { + var oldName = expectedName; + expectedName = 'testname'; + nodeunit.runTest(expectedName, exports.testArgs, { testDone: function (name, assertions) { + expectedName = oldName; test.equals(assertions.failures(), 0, 'failures'); - test.equals(assertions.length, 5, 'length'); + test.equals(assertions.length, 6, 'length'); test.ok(typeof assertions.duration === "number"); test.equals(name, 'testname'); }