diff --git a/test/pummel/test-hash-seed.js b/test/pummel/test-hash-seed.js index 05d29fff0b8b90..fd59bbe5e0653c 100644 --- a/test/pummel/test-hash-seed.js +++ b/test/pummel/test-hash-seed.js @@ -1,20 +1,20 @@ 'use strict'; +// Check that spawn child doesn't create duplicated entries +require('../common'); const REPETITIONS = 2; - const assert = require('assert'); -const common = require('../common'); -const cp = require('child_process'); -const path = require('path'); -const targetScript = path.resolve(common.fixturesDir, 'guess-hash-seed.js'); +const fixtures = require('../common/fixtures'); +const { spawnSync } = require('child_process'); +const targetScript = fixtures.path('guess-hash-seed.js'); const seeds = []; for (let i = 0; i < REPETITIONS; ++i) { - const seed = cp.spawnSync(process.execPath, [targetScript], - { encoding: 'utf8' }).stdout.trim(); + const seed = spawnSync(process.execPath, [targetScript], { + encoding: 'utf8' + }).stdout.trim(); seeds.push(seed); } console.log(`Seeds: ${seeds}`); -const hasDuplicates = (new Set(seeds)).size !== seeds.length; -assert.strictEqual(hasDuplicates, false); +assert.strictEqual(new Set(seeds).size, seeds.length);