diff --git a/src/index.ts b/src/index.ts index 93caf02..09c5dab 100644 --- a/src/index.ts +++ b/src/index.ts @@ -166,7 +166,7 @@ function createPreprocessor( return async function preprocess(content, file, done) { // We normalize the file extension to always be '.js', which allows us to // run '.ts' files as test entry-points in a `singleBundle: false` setup. - const jsPath = file.originalPath.replace(/\.[^/]+$/, ".js"); + const jsPath = file.originalPath.replace(/\.[^/.]+$/, ".js"); // Karma likes to turn a win32 path (C:\foo\bar) into a posix-like path (C:/foo/bar). // Normally this wouldn't be so bad, but `bundle.file` is a true win32 path, and we diff --git a/test/fixtures/typescript/files/main-a.ts b/test/fixtures/typescript/files/main-a.foo.ts similarity index 80% rename from test/fixtures/typescript/files/main-a.ts rename to test/fixtures/typescript/files/main-a.foo.ts index ed251be..ca8daa6 100644 --- a/test/fixtures/typescript/files/main-a.ts +++ b/test/fixtures/typescript/files/main-a.foo.ts @@ -13,7 +13,7 @@ describe("simple", () => { }); it("should serve with correct content-type", async () => { - const script = document.querySelector('script[src*="main-a.js"]'); + const script = document.querySelector('script[src*="main-a.foo.js"]'); const resp = await fetchPolyfill(script.src); if (resp.status !== 200) { @@ -27,9 +27,9 @@ describe("simple", () => { }); it("should serve .js.map", async () => { - const script = document.querySelector('script[src*="main-a.js"]'); + const script = document.querySelector('script[src*="main-a.foo.js"]'); - const src = `${script.src.replace(/[?#].*/, '')}.map`; + const src = `${script.src.replace(/[?#].*/, "")}.map`; const resp = await fetchPolyfill(src); if (resp.status !== 200) { throw new Error(resp.status);