Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return the created test in xit for bdd interface #3143

Merged
merged 4 commits into from Dec 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions appveyor.yml
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
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
@@ -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
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
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);
});
});