Skip to content

Commit

Permalink
tests after-/Each hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed Mar 5, 2019
1 parent 75a5651 commit 358fa27
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/integration/fixtures/pending/skip-sync-after.fixture.js
@@ -0,0 +1,18 @@
'use strict';

describe('skip in after', function () {
it('should run this test-1', function () {});

after('should print DeprecationWarning', function () {
this.skip();
throw new Error('never throws this error');
});

describe('inner suite', function () {
it('should run this test-2', function () {});
});
});

describe('second suite', function () {
it('should run this test-3', function () {});
});
15 changes: 15 additions & 0 deletions test/integration/fixtures/pending/skip-sync-afterEach.fixture.js
@@ -0,0 +1,15 @@
'use strict';

describe('skip in afterEach', function () {
it('should run this test-1', function () {});
it('should run this test-2', function () {});

afterEach('should print DeprecationWarning', function () {
this.skip();
throw new Error('never throws this error');
});
});

describe('second suite', function () {
it('should run this test-3', function () {});
});
44 changes: 44 additions & 0 deletions test/integration/pending.spec.js
Expand Up @@ -71,6 +71,28 @@ describe('pending', function() {
});
});

describe('in after', function() {
it('should run all tests', function(done) {
runMocha(
'pending/skip-sync-after.fixture.js',
args,
function(err, res) {
if (err) {
return done(err);
}
expect(res, 'to have passed').and('to satisfy', {
passing: 3,
failing: 0,
pending: 0,
output: expect.it('to contain', '"after all" hook is DEPRECATED')
});
done();
},
'pipe'
);
});
});

describe('in before', function() {
it('should skip all suite specs', function(done) {
run('pending/skip-sync-before.fixture.js', args, function(err, res) {
Expand Down Expand Up @@ -145,6 +167,28 @@ describe('pending', function() {
});
});

describe('in afterEach', function() {
it('should run all tests', function(done) {
runMocha(
'pending/skip-sync-afterEach.fixture.js',
args,
function(err, res) {
if (err) {
return done(err);
}
expect(res, 'to have passed').and('to satisfy', {
passing: 3,
failing: 0,
pending: 0,
output: expect.it('to contain', '"after each" hook is DEPRECATED')
});
done();
},
'pipe'
);
});
});

describe('in beforeEach', function() {
it('should skip all suite specs', function(done) {
run('pending/skip-sync-beforeEach.fixture.js', args, function(
Expand Down

0 comments on commit 358fa27

Please sign in to comment.