Skip to content

Commit

Permalink
return the created test in xit for bdd interface; closes #3142 (#3143)
Browse files Browse the repository at this point in the history
* Fixes #3142

* added test cases suggested by @boneskull

* fixed miswording

* attempt to fix bizarre AppVeyor problem by way of npm upgrade
  • Loading branch information
Bamieh authored and boneskull committed Dec 12, 2017
1 parent f7d6d8b commit 4c0df70
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 1 deletion.
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion lib/interfaces/bdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ module.exports = function (suite) {
*/

context.xit = context.xspecify = context.it.skip = function (title) {
context.it(title);
return context.it(title);
};

/**
Expand Down
7 changes: 7 additions & 0 deletions test/integration/fixtures/pending/skip-shorthand.fixture.js
Original file line number Diff line number Diff line change
@@ -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);
});
13 changes: 13 additions & 0 deletions test/integration/pending.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
24 changes: 24 additions & 0 deletions test/interfaces/bdd.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 active 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);
});
});

0 comments on commit 4c0df70

Please sign in to comment.