diff --git a/lib/results.js b/lib/results.js index 9a494094..7393128d 100644 --- a/lib/results.js +++ b/lib/results.js @@ -84,11 +84,6 @@ Results.prototype.push = function (t) { }; Results.prototype.only = function (name) { - if (this._only) { - self.count ++; - self.fail ++; - write('not ok ' + self.count + ' already called .only()\n'); - } this._only = name; }; diff --git a/test/only-twice.js b/test/only-twice.js new file mode 100644 index 00000000..ce6048ef --- /dev/null +++ b/test/only-twice.js @@ -0,0 +1,21 @@ +var tape = require('../'); +var tap = require('tap'); + +tap.test('only twice error', function (assert) { + var test = tape.createHarness({ exit : false }); + + test.only("first only", function (t) { + t.end() + }); + + assert.throws(function() { + test.only('second only', function(t) { + t.end(); + }); + }, { + name: 'Error', + message: 'there can only be one only test' + }); + assert.end(); +}); +