exports.timeEnd = function(label) {
- var duration = Date.now() - times[label];
+ var time = times[label];
+ if (!time) {
+ throw new Error('No such label: ' + label);
+ }
+ var duration = Date.now() - time;
exports.log('%s: %dms', label, duration);
};
assert.equal("{ slashes: '\\\\\\\\' }\n", strings.shift());
process.stderr.write('hello world');
+
+assert.throws(function () {
+ console.timeEnd('no such label');
+});
+
+assert.doesNotThrow(function () {
+ console.time('label');
+ console.timeEnd('label');
+});