@@ -20,7 +20,7 @@ test("Miniflare: accepts manually defined modules", async (t) => {
2020 // Check with just `path`
2121 const mf = new Miniflare ( {
2222 compatibilityDate : "2023-08-01" ,
23- compatibilityFlags : [ "nodejs_compat " ] ,
23+ compatibilityFlags : [ "nodejs_compat_v2 " ] ,
2424 // TODO(soon): remove `modulesRoot` once https://github.com/cloudflare/workerd/issues/1101 fixed
2525 // and add separate test for that
2626 modulesRoot : ROOT ,
@@ -29,7 +29,7 @@ test("Miniflare: accepts manually defined modules", async (t) => {
2929 { type : "ESModule" , path : path . join ( ROOT , "blobs.mjs" ) } ,
3030 { type : "ESModule" , path : path . join ( ROOT , "blobs-indirect.mjs" ) } ,
3131 { type : "CommonJS" , path : path . join ( ROOT , "index.cjs" ) } ,
32- { type : "NodeJsCompatModule " , path : path . join ( ROOT , "index.node.cjs" ) } ,
32+ { type : "CommonJS " , path : path . join ( ROOT , "index.node.cjs" ) } ,
3333 // Testing modules in subdirectories
3434 { type : "Text" , path : path . join ( ROOT , "blobs" , "text.txt" ) } ,
3535 { type : "Data" , path : path . join ( ROOT , "blobs" , "data.bin" ) } ,
@@ -51,7 +51,7 @@ test("Miniflare: accepts manually defined modules", async (t) => {
5151 "AGFzbQEAAAABBwFgAn9/AX8DAgEABwcBA2FkZAAACgkBBwAgACABawsACgRuYW1lAgMBAAA=" ;
5252 await mf . setOptions ( {
5353 compatibilityDate : "2023-08-01" ,
54- compatibilityFlags : [ "nodejs_compat " ] ,
54+ compatibilityFlags : [ "nodejs_compat_v2 " ] ,
5555 modules : [
5656 { type : "ESModule" , path : path . join ( ROOT , "index.mjs" ) } ,
5757 {
@@ -79,7 +79,7 @@ test("Miniflare: accepts manually defined modules", async (t) => {
7979 ` ,
8080 } ,
8181 {
82- type : "NodeJsCompatModule " ,
82+ type : "CommonJS " ,
8383 path : path . join ( ROOT , "index.node.cjs" ) ,
8484 contents : `module.exports = "node:";` ,
8585 } ,
@@ -112,14 +112,14 @@ test("Miniflare: automatically collects modules", async (t) => {
112112 modules : true ,
113113 modulesRoot : ROOT ,
114114 modulesRules : [
115- // Implicitly testing default module rules for `ESModule` and `CommonJS`
116- { type : "NodeJsCompatModule " , include : [ "**/*.node.cjs" ] } ,
115+ // Implicitly testing default module rules for `ESModule`
116+ { type : "CommonJS " , include : [ "**/*.node.cjs" , "**/* .cjs"] } ,
117117 { type : "Text" , include : [ "**/*.txt" ] } ,
118118 { type : "Data" , include : [ "**/*.bin" ] } ,
119119 { type : "CompiledWasm" , include : [ "**/*.wasm" ] } ,
120120 ] ,
121121 compatibilityDate : "2023-08-01" ,
122- compatibilityFlags : [ "nodejs_compat " ] ,
122+ compatibilityFlags : [ "nodejs_compat_v2 " ] ,
123123 scriptPath : path . join ( ROOT , "index.mjs" ) ,
124124 } ) ;
125125 t . teardown ( ( ) => mf . dispose ( ) ) ;
@@ -206,14 +206,14 @@ test("Miniflare: cannot automatically collect modules from dynamic import expres
206206 modules : true ,
207207 modulesRoot : ROOT ,
208208 modulesRules : [
209- // Implicitly testing default module rules for `ESModule` and `CommonJS`
210- { type : "NodeJsCompatModule " , include : [ "**/*.node.cjs" ] } ,
209+ // Implicitly testing default module rules for `ESModule`
210+ { type : "CommonJS " , include : [ "**/*.node.cjs" , "**/* .cjs"] } ,
211211 { type : "Text" , include : [ "**/*.txt" ] } ,
212212 { type : "Data" , include : [ "**/*.bin" ] } ,
213213 { type : "CompiledWasm" , include : [ "**/*.wasm" ] } ,
214214 ] ,
215215 compatibilityDate : "2023-08-01" ,
216- compatibilityFlags : [ "nodejs_compat " ] ,
216+ compatibilityFlags : [ "nodejs_compat_v2 " ] ,
217217 scriptPath,
218218 } ) ;
219219
@@ -233,7 +233,7 @@ You must manually define your modules when constructing Miniflare:
233233 modules: [
234234 { type: "ESModule", path: "index-dynamic.mjs" },
235235 { type: "CommonJS", path: "index.cjs" },
236- { type: "NodeJsCompatModule ", path: "index.node.cjs" },
236+ { type: "CommonJS ", path: "index.node.cjs" },
237237 { type: "ESModule", path: "blobs-indirect.mjs" },
238238 { type: "ESModule", path: "blobs.mjs" },
239239 { type: "Text", path: "blobs/text.txt" },
0 commit comments