Skip to content

Commit

Permalink
test: use common/fixtures module in hash-seed test
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Javier Blanco authored and MylesBorins committed Nov 28, 2017
1 parent 090cc97 commit a8cff7a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions 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);

0 comments on commit a8cff7a

Please sign in to comment.