From 36a2f1f10efa047b6942d0b494a23f6b0106e26a Mon Sep 17 00:00:00 2001 From: Bamieh Date: Mon, 11 Dec 2017 19:41:20 +0200 Subject: [PATCH] Fixes https://github.com/mochajs/mocha/issues/3142 --- lib/interfaces/bdd.js | 2 +- test/interfaces/bdd.spec.js | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/interfaces/bdd.js b/lib/interfaces/bdd.js index 33efc169a2..7a54375a94 100644 --- a/lib/interfaces/bdd.js +++ b/lib/interfaces/bdd.js @@ -102,7 +102,7 @@ module.exports = function (suite) { */ context.xit = context.xspecify = context.it.skip = function (title) { - context.it(title); + return context.it(title); }; /** diff --git a/test/interfaces/bdd.spec.js b/test/interfaces/bdd.spec.js index 2289c12497..2b492eb4a0 100644 --- a/test/interfaces/bdd.spec.js +++ b/test/interfaces/bdd.spec.js @@ -40,3 +40,27 @@ describe('pending suite', function () { }); }); }); + +describe('pending tests', function () { + it.skip('should not run', function () { + expect(1 + 1).to.equal(3); + }); +}); + +describe('setting timeout by appending it to test', function () { + var runningTest = it('enables users to call timeout on pending tests', function () { + expect(1 + 1).to.equal(2); + }).timeout(1003); + + var skippedTest = xit('enables users to call timeout on pending tests', function () { + expect(1 + 1).to.equal(3); + }).timeout(1002); + + it('sets timeout on pending tests', function () { + expect(skippedTest._timeout).to.equal(1002); + }); + + it('sets timeout on running tests', function () { + expect(runningTest._timeout).to.equal(1003); + }); +});