summaryrefslogtreecommitdiff
path: root/test/pummel/test-hash-seed.js
diff options
context:
space:
mode:
authorJavier Blanco <javier.blanco@axa-groupsolutions.com>2017-11-06 15:13:30 +0000
committerRich Trott <rtrott@gmail.com>2017-11-12 05:51:07 -0800
commit5f398b3e51286780cee10da3497752ca9a7f4609 (patch)
treeb0201ce14543ee09217f65586f923bc552678c9e /test/pummel/test-hash-seed.js
parent2cedff9c32e6260dbb655c8cf7104380f9bb2ef2 (diff)
downloadandroid-node-v8-5f398b3e51286780cee10da3497752ca9a7f4609.tar.gz
android-node-v8-5f398b3e51286780cee10da3497752ca9a7f4609.tar.bz2
android-node-v8-5f398b3e51286780cee10da3497752ca9a7f4609.zip
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: https://github.com/nodejs/node/pull/16823 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/pummel/test-hash-seed.js')
-rw-r--r--test/pummel/test-hash-seed.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/pummel/test-hash-seed.js b/test/pummel/test-hash-seed.js
index 05d29fff0b..fd59bbe5e0 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);