diff --git a/index.js b/index.js index 5da6eb42..904f366d 100644 --- a/index.js +++ b/index.js @@ -107,7 +107,7 @@ function createHarness(conf_) { var only = false; test.only = function () { if (only) { throw new Error('there can only be one only test'); } - if (conf_.noOnly) { throw new Error('`only` tests are prohibited'); } + if (conf_ && conf_.noOnly) { throw new Error('`only` tests are prohibited'); } only = true; var t = test.apply(null, arguments); results.only(t); diff --git a/test/exposed-harness.js b/test/exposed-harness.js index cb8b6019..fc375c29 100644 --- a/test/exposed-harness.js +++ b/test/exposed-harness.js @@ -3,12 +3,10 @@ var tape = require('../'); var tap = require('tap'); -tap.test('main harness object is exposed', function (assert) { +tap.test('main harness object is exposed', function (tt) { + tt.equal(typeof tape.getHarness, 'function', 'tape.getHarness is a function'); - assert.equal(typeof tape.getHarness, 'function', 'tape.getHarness is a function'); - - assert.equal(tape.getHarness()._results.pass, 0); - - assert.end(); + tt.equal(tape.getHarness()._results.pass, 0); + tt.end(); }); diff --git a/test/only.js b/test/only.js index 3302fb20..eb28ac65 100644 --- a/test/only.js +++ b/test/only.js @@ -46,3 +46,11 @@ tap.test('tape only test', function (tt) { t.end(); }); }); + +tap.test('created harness with no conf', function (tt) { + var harness = tape.createHarness(); + + tt.doesNotThrow(function () { harness.only({ skip: true }); }, 'harness.only does not throw with omitted harness conf arg'); + + tt.end(); +});