From 36a2f1f10efa047b6942d0b494a23f6b0106e26a Mon Sep 17 00:00:00 2001 From: Bamieh Date: Mon, 11 Dec 2017 19:41:20 +0200 Subject: [PATCH 1/4] 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); + }); +}); From 40b3b8672b3bf90c331386e3e8599d452b3954ad Mon Sep 17 00:00:00 2001 From: Bamieh Date: Mon, 11 Dec 2017 22:30:07 +0200 Subject: [PATCH 2/4] added test cases suggested by @boneskull --- .../fixtures/pending/skip-shorthand.fixture.js | 7 +++++++ test/integration/pending.spec.js | 13 +++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 test/integration/fixtures/pending/skip-shorthand.fixture.js diff --git a/test/integration/fixtures/pending/skip-shorthand.fixture.js b/test/integration/fixtures/pending/skip-shorthand.fixture.js new file mode 100644 index 0000000000..399dc48a65 --- /dev/null +++ b/test/integration/fixtures/pending/skip-shorthand.fixture.js @@ -0,0 +1,7 @@ +'use strict'; + +describe('pending shorthand', function () { + xit('pending spec', function () {}).timeout(0); + xspecify('pending spec', function () {}).timeout(0); + it.skip('pending spec', function () {}).timeout(0); +}); diff --git a/test/integration/pending.spec.js b/test/integration/pending.spec.js index f5a400f089..30cf61ceb2 100644 --- a/test/integration/pending.spec.js +++ b/test/integration/pending.spec.js @@ -19,6 +19,19 @@ describe('pending', function () { done(); }); }); + it('should return the test object when used via shorthand methods', function (done) { + run('pending/skip-shorthand.fixture.js', args, function (err, res) { + if (err) { + done(err); + return; + } + assert.equal(res.stats.pending, 3); + assert.equal(res.stats.passes, 0); + assert.equal(res.stats.failures, 0); + assert.equal(res.code, 0); + done(); + }); + }); }); describe('synchronous skip()', function () { From 7b82003c998dbbb07c8b0a902d586a96f5e51285 Mon Sep 17 00:00:00 2001 From: Bamieh Date: Mon, 11 Dec 2017 22:30:59 +0200 Subject: [PATCH 3/4] fixed miswording --- test/interfaces/bdd.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/interfaces/bdd.spec.js b/test/interfaces/bdd.spec.js index 2b492eb4a0..14365dc39a 100644 --- a/test/interfaces/bdd.spec.js +++ b/test/interfaces/bdd.spec.js @@ -48,7 +48,7 @@ describe('pending tests', function () { }); describe('setting timeout by appending it to test', function () { - var runningTest = it('enables users to call timeout on pending tests', function () { + var runningTest = it('enables users to call timeout on active tests', function () { expect(1 + 1).to.equal(2); }).timeout(1003); From e227a7835499b05e75b4ca8abff59b2660db2bb5 Mon Sep 17 00:00:00 2001 From: Christopher Hiller Date: Mon, 11 Dec 2017 20:21:58 -0800 Subject: [PATCH 4/4] attempt to fix bizarre AppVeyor problem by way of npm upgrade --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 2fe1c21c65..28da3062f1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,6 +9,7 @@ install: - set CI=true - set PATH=%APPDATA%\npm;c:\MinGW\bin;%PATH% - set PHANTOMJS_CDNURL=https://cnpmjs.org/downloads + - npm install -g npm - npm install - copy c:\MinGW\bin\mingw32-make.exe c:\MinGW\bin\make.exe matrix: