@@ -35,7 +35,7 @@ fs.writeFileSync(dotfileWithExtension, 'console.log(__filename);', 'utf8');
35
35
require ( modulePath ) ;
36
36
assert . throws (
37
37
( ) => require ( `${ modulePath } .foo` ) ,
38
- new Error ( `Cannot find module '${ modulePath } .foo'` )
38
+ ( err ) => err . message . startsWith ( `Cannot find module '${ modulePath } .foo'` )
39
39
) ;
40
40
require ( `${ modulePath } .foo.bar` ) ;
41
41
delete require . cache [ file ] ;
@@ -47,7 +47,7 @@ fs.writeFileSync(dotfileWithExtension, 'console.log(__filename);', 'utf8');
47
47
const modulePath = path . join ( tmpdir . path , 'test-extensions' ) ;
48
48
assert . throws (
49
49
( ) => require ( modulePath ) ,
50
- new Error ( `Cannot find module '${ modulePath } '` )
50
+ ( err ) => err . message . startsWith ( `Cannot find module '${ modulePath } '` )
51
51
) ;
52
52
delete require . cache [ file ] ;
53
53
Module . _pathCache = Object . create ( null ) ;
@@ -69,7 +69,7 @@ fs.writeFileSync(dotfileWithExtension, 'console.log(__filename);', 'utf8');
69
69
const modulePath = path . join ( tmpdir . path , 'test-extensions.foo' ) ;
70
70
assert . throws (
71
71
( ) => require ( modulePath ) ,
72
- new Error ( `Cannot find module '${ modulePath } '` )
72
+ ( err ) => err . message . startsWith ( `Cannot find module '${ modulePath } '` )
73
73
) ;
74
74
delete require . extensions [ '.foo.bar' ] ;
75
75
Module . _pathCache = Object . create ( null ) ;
0 commit comments