Browse Source

cleanup test fixtures

babel-plugin-for-integration-tests
Sindre Sorhus 9 years ago
parent
commit
83b189b535
  1. 3
      test/fixture/async-await.js
  2. 2
      test/fixture/circular-reference-on-assertion.js
  3. 2
      test/fixture/destructuring-public-api.js
  4. 3
      test/fixture/generators.js
  5. 5
      test/fixture/hooks-failing.js
  6. 5
      test/fixture/hooks-passing.js
  7. 1
      test/fixture/ignored-dirs/fixtures/test.js
  8. 1
      test/fixture/ignored-dirs/helpers/test.js
  9. 23
      test/fixture/long-running.js
  10. 4
      test/fixture/loud-rejection.js
  11. 2
      test/fixture/one-pass-one-fail.js
  12. 3
      test/fixture/process-cwd.js
  13. 2
      test/fixture/source-map-file.js
  14. 2
      test/fixture/source-map-inline.js
  15. 6
      test/fixture/throw-anonymous-function.js
  16. 6
      test/fixture/throw-named-function.js
  17. 6
      test/fixture/uncaught-exception.js

3
test/fixture/async-await.js

@ -1,5 +1,4 @@
'use strict';
const test = require('../../');
import test from '../../';
test('async function', async function (t) {
t.plan(1);

2
test/fixture/circular-reference-on-assertion.js

@ -1,7 +1,7 @@
import test from '../../';
test(t => {
var circular = ['a', 'b'];
const circular = ['a', 'b'];
circular.push(circular);
t.same([circular, 'c'], [circular, 'd']);
});

2
test/fixture/destructuring-public-api.js

@ -7,7 +7,7 @@ test.cb('callback mode', ({context: foo, ... t}) => {
t.end();
});
test.cb('callback mode', ({context: foo, end, ... t}) => {
test.cb('callback mode #2', ({context: foo, end, ... t}) => {
t.is(foo, 'bar');
end();
});

3
test/fixture/generators.js

@ -1,5 +1,4 @@
'use strict';
const test = require('../../');
import test from '../../';
test('generator function', function * (t) {
t.plan(1);

5
test/fixture/hooks-failing.js

@ -1,10 +1,9 @@
const test = require('../../');
import test from '../../';
test.beforeEach(fail);
test(pass);
function pass(t) {
}
function pass() {}
function fail(t) {
t.fail();

5
test/fixture/hooks-passing.js

@ -1,4 +1,4 @@
const test = require('../../');
import test from '../../';
test.before(pass);
test.beforeEach(pass);
@ -6,5 +6,4 @@ test.after(pass);
test.afterEach(pass);
test(pass);
function pass(t) {
}
function pass() {}

1
test/fixture/ignored-dirs/fixtures/test.js

@ -2,5 +2,4 @@ import test from '../../../../';
test(t => {
t.pass();
t.end();
});

1
test/fixture/ignored-dirs/helpers/test.js

@ -2,5 +2,4 @@ import test from '../../../../';
test(t => {
t.pass();
t.end();
});

23
test/fixture/long-running.js

@ -1,16 +1,17 @@
'use strict';
const test = require('../../');
var onExit = require('signal-exit');
import test from '../../';
import signalExit from 'signal-exit';
test.cb('long running', function (t) {
test.cb('long running', t => {
t.plan(1);
onExit(function () {
signalExit(() => {
// simulate an exit hook that lasts a short while
var start = Date.now();
while(Date.now() - start < 2000) {
//synchronously wait for 2 seconds
const start = Date.now();
while (Date.now() - start < 2000) {
// synchronously wait for 2 seconds
}
process.send({
name: 'cleanup-completed',
data: {completed: true},
@ -18,13 +19,13 @@ test.cb('long running', function (t) {
});
}, {alwaysLast: true});
setTimeout(function () {
setTimeout(() => {
t.ok(true);
t.end();
});
setTimeout(function () {
// this would keep the process running for a long time.
setTimeout(() => {
// this would keep the process running for a long time
console.log('I\'m gonna live forever!!');
}, 15000);
});

4
test/fixture/loud-rejection.js

@ -1,9 +1,9 @@
const test = require('../../');
import test from '../../';
test.cb('creates an unhandled rejection', t => {
Promise.reject(new Error(`You can't handle this!`));
setTimeout(function () {
setTimeout(() => {
t.end();
});
});

2
test/fixture/one-pass-one-fail.js

@ -1,4 +1,4 @@
const test = require('../../');
import test from '../../';
test('this is a passing test', t => {
t.ok(true);

3
test/fixture/process-cwd.js

@ -1,5 +1,4 @@
'use strict';
const test = require('../../');
import test from '../../';
test(t => {
t.is(process.cwd(), __dirname);

2
test/fixture/source-map-file.js

@ -4,7 +4,7 @@ const test = require('../../');
// The uncaught exception is passed to the corresponding cli test. The line
// numbers from the 'throws' fixture (which uses a map file), as well as the
// line of the fixture.run() call, should match the source lines.
test('throw an uncaught exception', t => {
test('throw an uncaught exception', () => {
setImmediate(run);
});

2
test/fixture/source-map-inline.js

@ -4,7 +4,7 @@ const test = require('../../');
// The uncaught exception is passed to the corresponding cli test. The line
// numbers from the 'throws' fixture (using an inline source map), as well as
// the line of the fixture.run() call, should match the source lines.
test('throw an uncaught exception', t => {
test('throw an uncaught exception', () => {
setImmediate(run);
});

6
test/fixture/throw-anonymous-function.js

@ -1,7 +1,7 @@
const test = require('../../');
import test from '../../';
test('throw an uncaught exception', t => {
test('throw an uncaught exception', () => {
setImmediate(() => {
throw function () {};
throw () => {};
});
});

6
test/fixture/throw-named-function.js

@ -1,9 +1,9 @@
const test = require('../../');
import test from '../../';
function fooFn() {}
test('throw an uncaught exception', t => {
test('throw an uncaught exception', () => {
setImmediate(() => {
throw fooFn
throw fooFn;
});
});

6
test/fixture/uncaught-exception.js

@ -1,7 +1,7 @@
const test = require('../../');
import test from '../../';
test('throw an uncaught exception', t => {
test('throw an uncaught exception', () => {
setImmediate(() => {
throw new Error(`Can't catch me!`)
throw new Error(`Can't catch me!`);
});
});

Loading…
Cancel
Save