Skip to content

Commit

Permalink
test: ensure loaders passes for non typescript files
Browse files Browse the repository at this point in the history
  • Loading branch information
arturgawlik authored and marco-ippolito committed Dec 18, 2024
1 parent 1e44465 commit c91d07d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/fixtures/hello.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("Hello, JavaScript!");
26 changes: 26 additions & 0 deletions test/loader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,29 @@ test("should not warn and accurate stracktrace", async () => {
match(result.stderr, /stacktrace.ts:4:7/); // accurate
strictEqual(result.code, 1);
});

test("should call nextLoader for non-typescript files for striping", async () => {
const result = await spawnPromisified(process.execPath, [
"--experimental-strip-types",
"--no-warnings",
"--import=./dist/register-strip.mjs",
fixturesPath("hello.js"),
]);

strictEqual(result.stderr, "");
match(result.stdout, /Hello, JavaScript!/);
strictEqual(result.code, 0);
});

test("should call nextLoader for non-typescript files for transform", async () => {
const result = await spawnPromisified(process.execPath, [
"--experimental-strip-types",
"--no-warnings",
"--import=./dist/register-transform.mjs",
fixturesPath("hello.js"),
]);

strictEqual(result.stderr, "");
match(result.stdout, /Hello, JavaScript!/);
strictEqual(result.code, 0);
});

0 comments on commit c91d07d

Please sign in to comment.