Skip to content

Commit

Permalink
test: Consistently throw errors in pending test fixtures.
Browse files Browse the repository at this point in the history
  • Loading branch information
bannmoore committed Dec 1, 2018
1 parent 5055a33 commit b858b43
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ describe('skip in before with nested describes', function () {
}, 0);
});

it('should never run this test', function () { });
it('should never run this test', function () {
throw new Error('never run this test');
});

describe('nested describe', function () {
before(function () {
throw new Error('first level before should not run');
});

it('should never run this test', function () { });
it('should never run this test', function () {
throw new Error('never run this test');
});

after(function () {
throw new Error('first level after should not run');
Expand All @@ -25,7 +29,9 @@ describe('skip in before with nested describes', function () {
throw new Error('second level before should not run');
});

it('should never run this test', function () { });
it('should never run this test', function () {
throw new Error('never run this test');
});

after(function () {
throw new Error('second level after should not run');
Expand Down
10 changes: 6 additions & 4 deletions test/integration/fixtures/pending/skip-async-before.fixture.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

describe('outer describe', function () {

it('should run this test', function () {});

describe('skip in before', function () {
Expand All @@ -12,10 +11,13 @@ describe('outer describe', function () {
}, 0);
});

it('should never run this test', function () {});
it('should never run this test', function () {});
it('should never run this test', function () {
throw new Error('never run this test');
});
it('should never run this test', function () {
throw new Error('never run this test');
});
});

it('should run this test', function () {});

});
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ describe('skip in beforeEach', function () {
}, 0);
});

it('should skip this test', function () {});
it('should error before reaching this test', function () {});
it('should error before reaching this test', function () {});
it('should skip this test', function () {
throw new Error('never run this test');
});
it('should not reach this test', function () {
throw new Error('never run this test');
});
it('should not reach this test', function () {
throw new Error('never run this test');
});
});
4 changes: 1 addition & 3 deletions test/integration/fixtures/pending/skip-async-spec.fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ describe('skip in test', function () {
}, 0);
});

it('should run other tests in the suite', function () {
// Do nothing
});
it('should run other tests in the suite', function () {});
});
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('outer suite', function () {
});

it('should never run this test', function () {
throw new Error('skipped suie test should not run');
throw new Error('skipped suite test should not run');
});

after(function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ describe('skip in before with nested describes', function () {
this.skip();
});

it('should never run this test', function () { });
it('should never run this test', function () {
throw new Error('never run this test');
});

describe('nested describe', function () {
before(function () {
throw new Error('first level before should not run');
});

it('should never run this test', function () { });
it('should never run this test', function () {
throw new Error('never run this test');
});

after(function () {
throw new Error('first level after should not run');
Expand All @@ -23,7 +27,9 @@ describe('skip in before with nested describes', function () {
throw new Error('second level before should not run');
});

it('should never run this test', function () { });
it('should never run this test', function () {
throw new Error('never run this test');
});

after(function () {
throw new Error('second level after should not run');
Expand Down
10 changes: 6 additions & 4 deletions test/integration/fixtures/pending/skip-sync-before.fixture.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
'use strict';

describe('outer describe', function () {

it('should run this test', function () {});

describe('skip in before', function () {
before(function () {
this.skip();
});

it('should never run this test', function () {});
it('should never run this test', function () {});
it('should never run this test', function () {
throw new Error('never run this test');
});
it('should never run this test', function () {
throw new Error('never run this test');
});
});

it('should run this test', function () {});

});
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ describe('skip in beforeEach', function () {
});

it('should never run this test', function () {
throw new Error('never thrown');
throw new Error('never run this test');
});

it('should never run this test', function () {
throw new Error('never thrown');
throw new Error('never run this test');
});
});
6 changes: 2 additions & 4 deletions test/integration/fixtures/pending/skip-sync-spec.fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
describe('skip in test', function () {
it('should skip immediately', function () {
this.skip();
throw new Error('never thrown');
throw new Error('never run this test');
});

it('should run other tests in the suite', function () {
// Do nothing
});
it('should run other tests in the suite', function () {});
});

0 comments on commit b858b43

Please sign in to comment.