Turbopack: test import.meta.glob code splitting with an execution test (#100532)
## Summary Replaces the `import.meta.glob` code-splitting snapshot test added in #100522 with an execution test. The new test checks the behavior directly: lazy matches load only when called, and each one loads separately. The test checks the runtime module factory map, `__turbopack_modules__`: - The eager match is in the map at startup and evaluates correctly. - Neither lazy match is in the map before its thunk is called. - Loading the first lazy match adds it to the map, but not the second one. - Loading the second lazy match then adds it too. The check targets each module's `(ecmascript)` entry. The map also contains `(ecmascript, async loader)` stubs, and those ship in the importing chunk, so matching on the source path alone would show the lazy targets as already loaded. This is a separate fixture because the existing `resolving/import-meta-glob` test imports the same files both lazily and eagerly, so it can't show that a lazy target isn't loaded yet. The snapshot fixture and its generated chunks are removed. There are no production code changes. ## Verification - With `turbopack/crates/turbopack-ecmascript/src/references/import_meta_glob.rs` temporarily set back to its state before #100522, the new execution test fails because a lazy match is already in the module map before its thunk is called. - With the current implementation, all `import_meta_glob*` execution tests pass, and the remaining `snapshot/imports` tests pass. <!-- NEXT_JS_LLM --> <!-- fleet ca9e5cd1-7e86-4f88-b9f3-22f348cd6f50 --> Co-authored-by:vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Luke Sandberg <210140+lukesandberg@users.noreply.github.com>
Showing
File moved
File moved
File moved
Please
register
or
sign in
to comment