Skip to content

Commit

Permalink
move existing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed Jan 12, 2020
1 parent 6dbc68a commit c35e4e9
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 38 deletions.
33 changes: 0 additions & 33 deletions test/integration/regression.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,6 @@ var run = require('./helpers').runMocha;
var runJSON = require('./helpers').runMochaJSON;

describe('regressions', function() {
it('issue-1327: should run the first test and then bail', function(done) {
var args = [];
runJSON('regression/issue-1327.fixture.js', args, function(err, res) {
if (err) {
return done(err);
}
expect(res, 'to have failed')
.and('to have passed test count', 1)
.and('to have failed test count', 1)
.and('to have passed test', 'test 1')
.and('to have failed test', 'test 1');
done();
});
});

it('issue-1991: Declarations do not get cleaned up unless you set them to `null` - Memory Leak', function(done) {
// on a modern MBP takes ±5 seconds on node 4.0, but on older laptops with node 0.12 ±40 seconds.
// Could easily take longer on even weaker machines (Travis-CI containers for example).
Expand Down Expand Up @@ -90,22 +75,4 @@ describe('regressions', function() {
done();
});
});

it('issue-1417 uncaught exceptions from async specs', function(done) {
runJSON('regression/issue-1417.fixture.js', [], function(err, res) {
if (err) {
done(err);
return;
}
expect(res, 'to have failed with errors', 'sync error a', 'sync error b')
.and('to have exit code', 2)
.and('not to have passed tests')
.and('not to have pending tests')
.and('to have failed test order', [
'fails exactly once when a global error is thrown synchronously and done errors',
'fails exactly once when a global error is thrown synchronously and done completes'
]);
done();
});
});
});
42 changes: 37 additions & 5 deletions test/integration/uncaught.spec.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
'use strict';

var assert = require('assert');
var run = require('./helpers').runMochaJSON;
var helpers = require('./helpers');
var run = helpers.runMochaJSON;
var args = [];

describe('uncaught exceptions', function() {
it('handles uncaught exceptions from hooks', function(done) {
run('uncaught-hook.fixture.js', args, function(err, res) {
run('uncaught/hook.fixture.js', args, function(err, res) {
if (err) {
done(err);
return;
Expand All @@ -25,7 +26,7 @@ describe('uncaught exceptions', function() {
});

it('handles uncaught exceptions from async specs', function(done) {
run('uncaught.fixture.js', args, function(err, res) {
run('uncaught/double.fixture.js', args, function(err, res) {
if (err) {
done(err);
return;
Expand All @@ -48,7 +49,7 @@ describe('uncaught exceptions', function() {
});

it('handles uncaught exceptions from which Mocha cannot recover', function(done) {
run('uncaught-fatal.fixture.js', args, function(err, res) {
run('uncaught/fatal.fixture.js', args, function(err, res) {
if (err) {
return done(err);
}
Expand All @@ -65,7 +66,7 @@ describe('uncaught exceptions', function() {
});

it('handles uncaught exceptions within pending tests', function(done) {
run('uncaught-pending.fixture.js', args, function(err, res) {
run('uncaught/pending.fixture.js', args, function(err, res) {
if (err) {
return done(err);
}
Expand Down Expand Up @@ -98,4 +99,35 @@ describe('uncaught exceptions', function() {
done();
});
});

it('issue-1327: should run the first test and then bail', function(done) {
run('uncaught/issue-1327.fixture.js', args, function(err, res) {
if (err) {
return done(err);
}
expect(res, 'to have failed')
.and('to have passed test count', 1)
.and('to have failed test count', 1)
.and('to have passed test', 'test 1')
.and('to have failed test', 'test 1');
done();
});
});

it('issue-1417: uncaught exceptions from async specs', function(done) {
run('uncaught/issue-1417.fixture.js', args, function(err, res) {
if (err) {
return done(err);
}
expect(res, 'to have failed with errors', 'sync error a', 'sync error b')
.and('to have exit code', 2)
.and('not to have passed tests')
.and('not to have pending tests')
.and('to have failed test order', [
'fails exactly once when a global error is thrown synchronously and done errors',
'fails exactly once when a global error is thrown synchronously and done completes'
]);
done();
});
});
});

0 comments on commit c35e4e9

Please sign in to comment.