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 Feb 9, 2019
1 parent 92431bb commit 4b96355
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/integration/fixtures/pending/skip-sync-after.fixture.js
@@ -0,0 +1,14 @@
'use strict';

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

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

describe('second suite', function () {
it('should run this test', 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', function () {});
it('should run this test', function () {});

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

describe('second suite', function () {
it('should run this test', function () {});
});
42 changes: 42 additions & 0 deletions test/integration/pending.spec.js
Expand Up @@ -71,6 +71,27 @@ 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.code, 'to be', 0);
expect(res.passing, 'to be', 2);
expect(res.failing, 'to be', 0);
expect(res.pending, 'to be', 0);
expect(res.output, 'to contain', "'afterAll' 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 +166,27 @@ 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.code, 'to be', 0);
expect(res.passing, 'to be', 3);
expect(res.failing, 'to be', 0);
expect(res.pending, 'to be', 0);
expect(res.output, 'to contain', "'afterEach' 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 4b96355

Please sign in to comment.