2025-09-15 00:24:00 +08:00
|
|
|
import fs from "fs";
|
|
|
|
import path from "path";
|
|
|
|
import url from "../../asset-modules/_images/file.png";
|
|
|
|
|
|
|
|
import(/* webpackChunkName: 'file' */ "./file.txt?foo");
|
|
|
|
|
2025-10-07 00:39:29 +08:00
|
|
|
it("should emit manifest with expected entries and paths with string publicPath", () => {
|
2025-09-15 00:24:00 +08:00
|
|
|
expect(url).toEqual("/app/file-loader.png");
|
|
|
|
|
|
|
|
const manifest = JSON.parse(
|
2025-10-07 00:39:29 +08:00
|
|
|
fs.readFileSync(path.resolve(__dirname, "foo.json"), "utf-8")
|
2025-09-15 00:24:00 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
const keys = Object.keys(manifest).sort();
|
|
|
|
expect(keys).toEqual(
|
|
|
|
[
|
|
|
|
"file.js",
|
|
|
|
"file.txt?foo",
|
|
|
|
"main.js",
|
|
|
|
"third.party.js",
|
|
|
|
"file.png"
|
|
|
|
].sort()
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(manifest["main.js"]).toMatch(/\/app\/bundle0\.js/);
|
|
|
|
expect(manifest["file.js"]).toMatch(/\/app\/file\.[a-f0-9]+\.js/);
|
|
|
|
expect(manifest["file.txt?foo"]).toMatch(/\/app\/file\.[a-f0-9]+\.txt\?foo/);
|
|
|
|
expect(manifest["third.party.js"]).toBe("/app/third.party.js");
|
|
|
|
expect(manifest["file.png"]).toBe("/app/file-loader.png");
|
|
|
|
});
|