Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit e706222

Browse files
Bamiehboneskull
authored andcommitted
return the created test in xit for bdd interface; closes mochajs#3142 (mochajs#3143)
* Fixes mochajs#3142 * added test cases suggested by @boneskull * fixed miswording * attempt to fix bizarre AppVeyor problem by way of npm upgrade
1 parent 5aa4fcf commit e706222

File tree

5 files changed

+46
-1
lines changed

5 files changed

+46
-1
lines changed

appveyor.yml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ install:
99
- set CI=true
1010
- set PATH=%APPDATA%\npm;c:\MinGW\bin;%PATH%
1111
- set PHANTOMJS_CDNURL=https://cnpmjs.org/downloads
12+
- npm install -g npm
1213
- npm install
1314
- copy c:\MinGW\bin\mingw32-make.exe c:\MinGW\bin\make.exe
1415
matrix:

lib/interfaces/bdd.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ module.exports = function (suite) {
102102
*/
103103

104104
context.xit = context.xspecify = context.it.skip = function (title) {
105-
context.it(title);
105+
return context.it(title);
106106
};
107107

108108
/**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
describe('pending shorthand', function () {
4+
xit('pending spec', function () {}).timeout(0);
5+
xspecify('pending spec', function () {}).timeout(0);
6+
it.skip('pending spec', function () {}).timeout(0);
7+
});

test/integration/pending.spec.js

+13
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ describe('pending', function () {
1919
done();
2020
});
2121
});
22+
it('should return the test object when used via shorthand methods', function (done) {
23+
run('pending/skip-shorthand.fixture.js', args, function (err, res) {
24+
if (err) {
25+
done(err);
26+
return;
27+
}
28+
assert.equal(res.stats.pending, 3);
29+
assert.equal(res.stats.passes, 0);
30+
assert.equal(res.stats.failures, 0);
31+
assert.equal(res.code, 0);
32+
done();
33+
});
34+
});
2235
});
2336

2437
describe('synchronous skip()', function () {

test/interfaces/bdd.spec.js

+24
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,27 @@ describe('pending suite', function () {
4040
});
4141
});
4242
});
43+
44+
describe('pending tests', function () {
45+
it.skip('should not run', function () {
46+
expect(1 + 1).to.equal(3);
47+
});
48+
});
49+
50+
describe('setting timeout by appending it to test', function () {
51+
var runningTest = it('enables users to call timeout on active tests', function () {
52+
expect(1 + 1).to.equal(2);
53+
}).timeout(1003);
54+
55+
var skippedTest = xit('enables users to call timeout on pending tests', function () {
56+
expect(1 + 1).to.equal(3);
57+
}).timeout(1002);
58+
59+
it('sets timeout on pending tests', function () {
60+
expect(skippedTest._timeout).to.equal(1002);
61+
});
62+
63+
it('sets timeout on running tests', function () {
64+
expect(runningTest._timeout).to.equal(1003);
65+
});
66+
});

0 commit comments

Comments
 (0)