Skip to content

Commit b3d27ca

Browse files
committed
update
1 parent c03bc2c commit b3d27ca

4 files changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
it("should not include empty ignoreList in source map", () => {
2+
const fs = require("fs");
3+
const path = require("path");
4+
const sourceMapPath = path.join(__dirname, "bundle0.js.map");
5+
const sourceMapContent = fs.readFileSync(sourceMapPath, "utf-8");
6+
7+
expect(sourceMapContent).not.toMatch(/"ignoreList"\s*:\s*\[\s*\]/);
8+
9+
// Verify default source map properties are present
10+
const sourceMap = JSON.parse(sourceMapContent);
11+
expect(sourceMap).toHaveProperty("version", 3);
12+
expect(sourceMap).toHaveProperty("sources");
13+
expect(Array.isArray(sourceMap.sources)).toBe(true);
14+
expect(sourceMap.sources.length).toBeGreaterThan(0);
15+
});
16+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"use strict";
2+
3+
/** @type {import("../../../../").Configuration} */
4+
module.exports = {
5+
mode: "development",
6+
devtool: "source-map",
7+
entry: "./index.js"
8+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
it("should not include empty ignoreList in eval source map", () => {
2+
const fs = require("fs");
3+
const source = fs.readFileSync(__filename, "utf-8");
4+
5+
const match = /sourceMappingURL\s*=\s*data:application\/json;charset=utf-8;base64,([A-Za-z0-9+\/=]+)/.exec(
6+
source
7+
);
8+
expect(match).not.toBeNull();
9+
const mapString = Buffer.from(match[1], "base64").toString("utf-8");
10+
11+
expect(mapString).not.toMatch(/"ignoreList"\s*:\s*\[\s*\]/);
12+
13+
// Verify default source map properties are present
14+
const sourceMap = JSON.parse(mapString);
15+
expect(sourceMap).toHaveProperty("version", 3);
16+
expect(sourceMap).toHaveProperty("sources");
17+
expect(Array.isArray(sourceMap.sources)).toBe(true);
18+
expect(sourceMap.sources.length).toBeGreaterThan(0);
19+
});
20+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"use strict";
2+
3+
/** @type {import("../../../../").Configuration} */
4+
module.exports = {
5+
mode: "development",
6+
devtool: "eval-source-map",
7+
entry: "./index.js"
8+
};

0 commit comments

Comments
 (0)