mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
### What does this PR do? Fixes #24387 ### How did you verify your code works? --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Marko Vejnovic <marko@bun.com>
24 lines
694 B
TypeScript
24 lines
694 B
TypeScript
import { bunEnv, bunExe } from "harness";
|
|
import { join } from "path";
|
|
|
|
test("regression: require()ing a module with TLA should error and then wipe the module cache, so that importing it again works", async () => {
|
|
const proc = Bun.spawn({
|
|
cmd: [bunExe(), "run", "--smol", join(import.meta.dir, "24387", "entry.js")],
|
|
env: bunEnv,
|
|
stdout: "pipe",
|
|
stderr: "pipe",
|
|
});
|
|
|
|
const { stdout, stderr } = proc;
|
|
|
|
expect(await stderr.text()).toBe("");
|
|
expect(await stdout.text()).toMatchInlineSnapshot(`
|
|
"require() async module "<the module>" is unsupported. use "await import()" instead.
|
|
Module {
|
|
foo: 67,
|
|
}
|
|
"
|
|
`);
|
|
expect(await proc.exited).toBe(0);
|
|
});
|