File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
const common = require ( '../common' ) ;
3
3
const assert = require ( 'assert' ) ;
4
+ const fixtures = require ( '../common/fixtures' ) ;
4
5
5
6
// A module with an error in it should throw
6
7
assert . throws ( function ( ) {
7
- require ( ` ${ common . fixturesDir } /throws_error` ) ;
8
+ require ( fixtures . path ( ' /throws_error' ) ) ;
8
9
} , / ^ E r r o r : b l a h $ / ) ;
9
10
10
11
// Requiring the same module again should throw as well
11
12
assert . throws ( function ( ) {
12
- require ( ` ${ common . fixturesDir } /throws_error` ) ;
13
+ require ( fixtures . path ( ' /throws_error' ) ) ;
13
14
} , / ^ E r r o r : b l a h $ / ) ;
14
15
15
16
// Requiring a module that does not exist should throw an
@@ -22,13 +23,13 @@ assertModuleNotFound('/module-require/not-found/trailingSlash');
22
23
23
24
function assertModuleNotFound ( path ) {
24
25
assert . throws ( function ( ) {
25
- require ( common . fixturesDir + path ) ;
26
+ require ( fixtures . path ( path ) ) ;
26
27
} , function ( e ) {
27
28
assert . strictEqual ( e . code , 'MODULE_NOT_FOUND' ) ;
28
29
return true ;
29
30
} ) ;
30
31
}
31
32
32
33
function assertExists ( fixture ) {
33
- assert ( common . fileExists ( common . fixturesDir + fixture ) ) ;
34
+ assert ( common . fileExists ( fixtures . path ( fixture ) ) ) ;
34
35
}
You can’t perform that action at this time.
0 commit comments