mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
330f25ef82
Make changes so that tests will pass when the comma-dangle settings applied to the rest of the code base are also applied to tests. PR-URL: https://github.com/nodejs/node/pull/37930 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
34 lines
949 B
JavaScript
34 lines
949 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const Countdown = require('../common/countdown');
|
|
const fixtures = require('../common/fixtures');
|
|
const { execFile } = require('child_process');
|
|
|
|
let done = '';
|
|
const countdown = new Countdown(2, () => done = true);
|
|
assert.strictEqual(countdown.remaining, 2);
|
|
countdown.dec();
|
|
assert.strictEqual(countdown.remaining, 1);
|
|
countdown.dec();
|
|
assert.strictEqual(countdown.remaining, 0);
|
|
assert.strictEqual(done, true);
|
|
|
|
const failFixtures = [
|
|
[
|
|
fixtures.path('failcounter.js'),
|
|
'Mismatched <anonymous> function calls. Expected exactly 1, actual 0.',
|
|
],
|
|
];
|
|
|
|
for (const p of failFixtures) {
|
|
const [file, expected] = p;
|
|
execFile(process.argv[0], [file], common.mustCall((ex, stdout, stderr) => {
|
|
assert.ok(ex);
|
|
assert.strictEqual(stderr, '');
|
|
const firstLine = stdout.split('\n').shift();
|
|
assert.strictEqual(firstLine, expected);
|
|
}));
|
|
}
|