Skip to content

Commit a8cff7a

Browse files
Javier BlancoMylesBorins
Javier Blanco
authored andcommitted
test: use common/fixtures module in hash-seed test
Replace `common.fixturesDir` with `fixtures.path()` usage in test/pummel/test-hash-seed.js. PR-URL: #16823 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 090cc97 commit a8cff7a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

test/pummel/test-hash-seed.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
'use strict';
22

3+
// Check that spawn child doesn't create duplicated entries
4+
require('../common');
35
const REPETITIONS = 2;
4-
56
const assert = require('assert');
6-
const common = require('../common');
7-
const cp = require('child_process');
8-
const path = require('path');
9-
const targetScript = path.resolve(common.fixturesDir, 'guess-hash-seed.js');
7+
const fixtures = require('../common/fixtures');
8+
const { spawnSync } = require('child_process');
9+
const targetScript = fixtures.path('guess-hash-seed.js');
1010
const seeds = [];
1111

1212
for (let i = 0; i < REPETITIONS; ++i) {
13-
const seed = cp.spawnSync(process.execPath, [targetScript],
14-
{ encoding: 'utf8' }).stdout.trim();
13+
const seed = spawnSync(process.execPath, [targetScript], {
14+
encoding: 'utf8'
15+
}).stdout.trim();
1516
seeds.push(seed);
1617
}
1718

1819
console.log(`Seeds: ${seeds}`);
19-
const hasDuplicates = (new Set(seeds)).size !== seeds.length;
20-
assert.strictEqual(hasDuplicates, false);
20+
assert.strictEqual(new Set(seeds).size, seeds.length);

0 commit comments

Comments
 (0)