-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: use the common/fixtures module to load the fixtures #16823
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
'use strict'; | ||
|
||
// Check that spawn child don't create duplicated entries | ||
require('common'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does not seem to work without relative paths, can you change it to |
||
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'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you change this to |
||
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; | ||
const hasDuplicates = new Set(seeds).size !== seeds.length; | ||
assert.strictEqual(hasDuplicates, false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this could just be changed to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't
-->doesn't