@@ -11,25 +11,33 @@ import { moduleMockingPlugin } from '../dist/moduleMockingPlugin.js';
1111const dirname = fileURLToPath ( new URL ( '.' , import . meta. url ) ) ;
1212
1313describe ( 'moduleMockingPlugin' , { timeout : 20000 } , ( ) => {
14- it ( 'can intercept server relative modules' , { todo : 'fails under node:test runner, works with mocha - investigate' } , async ( ) => {
15- await runTests ( {
16- files : [ path . join ( dirname , 'fixtures' , 'server-relative' , 'browser-test.js' ) ] ,
17- browsers : [ chromeLauncher ( ) ] ,
18- plugins : [ moduleMockingPlugin ( ) , nodeResolvePlugin ( '' , false , { } ) ] ,
19- } ) ;
20- } ) ;
14+ it (
15+ 'can intercept server relative modules' ,
16+ { todo : 'fails under node:test runner, works with mocha - investigate' } ,
17+ async ( ) => {
18+ await runTests ( {
19+ files : [ path . join ( dirname , 'fixtures' , 'server-relative' , 'browser-test.js' ) ] ,
20+ browsers : [ chromeLauncher ( ) ] ,
21+ plugins : [ moduleMockingPlugin ( ) , nodeResolvePlugin ( '' , false , { } ) ] ,
22+ } ) ;
23+ } ,
24+ ) ;
2125
22- it ( 'can intercept bare modules' , { todo : 'fails under node:test runner, works with mocha - investigate' } , async ( ) => {
23- const rootDir = path . resolve ( dirname , 'fixtures' , 'bare' , 'fixture' ) ;
24- // Define the bare module as duped to force nodeResolve to use the passed rootDir instead of the cwd
25- const dedupe = ( importee : string ) => importee === 'time-library/hour' ;
26+ it (
27+ 'can intercept bare modules' ,
28+ { todo : 'fails under node:test runner, works with mocha - investigate' } ,
29+ async ( ) => {
30+ const rootDir = path . resolve ( dirname , 'fixtures' , 'bare' , 'fixture' ) ;
31+ // Define the bare module as duped to force nodeResolve to use the passed rootDir instead of the cwd
32+ const dedupe = ( importee : string ) => importee === 'time-library/hour' ;
2633
27- await runTests ( {
28- files : [ path . join ( dirname , 'fixtures' , 'bare' , 'browser-test.js' ) ] ,
29- browsers : [ chromeLauncher ( ) ] ,
30- plugins : [ moduleMockingPlugin ( ) , nodeResolvePlugin ( rootDir , false , { dedupe } ) ] ,
31- } ) ;
32- } ) ;
34+ await runTests ( {
35+ files : [ path . join ( dirname , 'fixtures' , 'bare' , 'browser-test.js' ) ] ,
36+ browsers : [ chromeLauncher ( ) ] ,
37+ plugins : [ moduleMockingPlugin ( ) , nodeResolvePlugin ( rootDir , false , { dedupe } ) ] ,
38+ } ) ;
39+ } ,
40+ ) ;
3341
3442 it ( 'throws when trying to intercept without the plugin' , async ( ) => {
3543 const { sessions } = await runTests (
0 commit comments