Skip to content

Commit

Permalink
chore: test case
Browse files Browse the repository at this point in the history
  • Loading branch information
SyMind committed Oct 30, 2024
1 parent 13c07df commit 8edfc19
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import fs from "fs";
import fs from "fs/promises";
import path from "path";

it("source-map-filename/name should same", async function () {
import("./two");
expect(
fs.readdirSync(path.resolve(__dirname, "")).includes("main.js.map")
).toBe(true);

expect(async () => await fs.stat(path.resolve(__dirname, "../maps/main.js.map"))).not.toThrow();

const outputCode = await fs.readFile(__filename, 'utf-8');
const sourceMapPath = outputCode.match(/\/\/# sourceMappingURL=(.*)/)?.[1];
expect(sourceMapPath).toBe("maps/main.js.map");
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ module.exports = {
target: "node",
output: {
filename: "[name].js",
sourceMapFilename: "[name].js.map"
sourceMapFilename: "../maps/[name].js.map"
}
};

0 comments on commit 8edfc19

Please sign in to comment.