1
1
'use strict' ;
2
2
3
3
const common = require ( '../common' ) ;
4
+ const fixtures = require ( '../common/fixtures' ) ;
4
5
// Refs: https://github.com/nodejs/node/pull/2253
5
6
if ( common . isSunOS )
6
7
common . skip ( 'unreliable on SunOS' ) ;
7
8
8
9
const assert = require ( 'assert' ) ;
9
- const path = require ( 'path' ) ;
10
10
const childProcess = require ( 'child_process' ) ;
11
11
12
12
const nodeBinary = process . argv [ 0 ] ;
@@ -19,13 +19,11 @@ const preloadOption = (preloads) => {
19
19
return option ;
20
20
} ;
21
21
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' ) ;
29
27
30
28
// test preloading a single module works
31
29
childProcess . exec ( `"${ nodeBinary } " ${ preloadOption ( [ fixtureA ] ) } "${ fixtureB } "` ,
@@ -124,19 +122,19 @@ interactive.stdin.write('a\n');
124
122
interactive . stdin . write ( 'process.exit()\n' ) ;
125
123
126
124
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' ) } "`,
129
127
function ( err , stdout , stderr ) {
130
128
if ( err ) throw err ;
131
129
assert . ok ( / w o r k e r t e r m i n a t e d w i t h c o d e 4 3 / . test ( stdout ) ) ;
132
130
}
133
131
) ;
134
132
135
133
// https://github.com/nodejs/node/issues/1691
136
- process . chdir ( common . fixturesDir ) ;
134
+ process . chdir ( fixtures . fixturesDir ) ;
137
135
childProcess . exec (
138
136
`"${ 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` ,
140
138
function ( err , stdout , stderr ) {
141
139
if ( err ) throw err ;
142
140
assert . ok ( / w o r k e r t e r m i n a t e d w i t h c o d e 4 3 / . test ( stdout ) ) ;
0 commit comments