Skip to content

Commit

Permalink
Fixes #3142
Browse files Browse the repository at this point in the history
  • Loading branch information
Bamieh committed Dec 11, 2017
1 parent 5fbbce9 commit 36a2f1f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
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
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 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);
});
});

2 comments on commit 36a2f1f

@boneskull
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please open PR for this

@boneskull
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Bamieh also we should probably add integration tests. the bdd interface tests aren't very valuable.

please add this to test/integration/pending.spec.js

    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();
      });
    });

and this fixture in test/integration/fixtures/pending/skip-shorthand.fixture.js:

'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);
});

Please sign in to comment.