11'use strict' ;
22
33const common = require ( '../common' ) ;
4+ const fixtures = require ( '../common/fixtures' ) ;
45// Refs: https://github.com/nodejs/node/pull/2253
56if ( common . isSunOS )
67 common . skip ( 'unreliable on SunOS' ) ;
78
89const assert = require ( 'assert' ) ;
9- const path = require ( 'path' ) ;
1010const childProcess = require ( 'child_process' ) ;
1111
1212const 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
3129childProcess . exec ( `"${ nodeBinary } " ${ preloadOption ( [ fixtureA ] ) } "${ fixtureB } "` ,
@@ -124,19 +122,19 @@ interactive.stdin.write('a\n');
124122interactive . stdin . write ( 'process.exit()\n' ) ;
125123
126124childProcess . 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 ( / 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 ) ) ;
132130 }
133131) ;
134132
135133// https://github.com/nodejs/node/issues/1691
136- process . chdir ( common . fixturesDir ) ;
134+ process . chdir ( fixtures . fixturesDir ) ;
137135childProcess . 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 ( / 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