Skip to content

Commit 683c5fa

Browse files
lzcabreraMylesBorins
authored andcommitted
test: use common.fixtures module in test-preload
PR-URL: #15975 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent 000965d commit 683c5fa

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

test/parallel/test-preload.js

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

33
const common = require('../common');
4+
const fixtures = require('../common/fixtures');
45
// Refs: https://github.com/nodejs/node/pull/2253
56
if (common.isSunOS)
67
common.skip('unreliable on SunOS');
78

89
const assert = require('assert');
9-
const path = require('path');
1010
const childProcess = require('child_process');
1111

1212
const nodeBinary = process.argv[0];
@@ -19,13 +19,11 @@ const preloadOption = (preloads) => {
1919
return option;
2020
};
2121

22-
const fixture = (name) => path.join(common.fixturesDir, name);
23-
24-
const fixtureA = fixture('printA.js');
25-
const fixtureB = fixture('printB.js');
26-
const fixtureC = fixture('printC.js');
27-
const fixtureD = fixture('define-global.js');
28-
const fixtureThrows = fixture('throws_error4.js');
22+
const fixtureA = fixtures.path('printA.js');
23+
const fixtureB = fixtures.path('printB.js');
24+
const fixtureC = fixtures.path('printC.js');
25+
const fixtureD = fixtures.path('define-global.js');
26+
const fixtureThrows = fixtures.path('throws_error4.js');
2927

3028
// test preloading a single module works
3129
childProcess.exec(`"${nodeBinary}" ${preloadOption([fixtureA])} "${fixtureB}"`,
@@ -124,19 +122,19 @@ interactive.stdin.write('a\n');
124122
interactive.stdin.write('process.exit()\n');
125123

126124
childProcess.exec(
127-
`"${nodeBinary}" --require "${fixture('cluster-preload.js')}" "${
128-
fixture('cluster-preload-test.js')}"`,
125+
`"${nodeBinary}" --require "${fixtures.path('cluster-preload.js')}" "${
126+
fixtures.path('cluster-preload-test.js')}"`,
129127
function(err, stdout, stderr) {
130128
if (err) throw err;
131129
assert.ok(/worker terminated with code 43/.test(stdout));
132130
}
133131
);
134132

135133
// https://github.com/nodejs/node/issues/1691
136-
process.chdir(common.fixturesDir);
134+
process.chdir(fixtures.fixturesDir);
137135
childProcess.exec(
138136
`"${nodeBinary}" --expose_natives_as=v8natives --require ` +
139-
`"${fixture('cluster-preload.js')}" cluster-preload-test.js`,
137+
`"${fixtures.path('cluster-preload.js')}" cluster-preload-test.js`,
140138
function(err, stdout, stderr) {
141139
if (err) throw err;
142140
assert.ok(/worker terminated with code 43/.test(stdout));

0 commit comments

Comments
 (0)