1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
it("should generate the correct output files", () => {
// It should not generate a JS chunk file for the localization-only chunk
expect(
__STATS__.children[INDEX].assets.map(asset => asset.name).sort()
).toEqual(
[
NORMAL1 && `634.bundle${INDEX}.js`,
NORMAL2 && `882.bundle${INDEX}.js`,
`bundle${INDEX}.js`,
CONTENT2 && "localization-264.js",
"localization-530.js",
NORMAL1 && "localization-634.js",
NORMAL2 && "localization-882.js"
].filter(Boolean)
);
});
it("should load a chunk with only the custom source type", () => {
return import("./content.loc").then(({ default: content }) => {
expect(content).toEqual({
value: "Translated text"
});
});
});
if (CONTENT2) {
it("should load a chunk with only the custom source type", () => {
return import("./content2.loc").then(({ default: content }) => {
expect(content).toEqual({
value: "Translated text 2"
});
});
});
}
if (NORMAL1) {
it("should still load normal chunks", () => {
if (TARGET === "web") {
Promise.resolve().then(() => {
__non_webpack_require__(`./634.bundle${INDEX}.js`);
});
}
return import("./normal.js").then(({ default: value }) => {
expect(value).toBe(42);
});
});
}
if (NORMAL2) {
it("should still another load normal chunks", () => {
if (TARGET === "web") {
Promise.resolve().then(() => {
__non_webpack_require__(`./882.bundle${INDEX}.js`);
});
}
return import("./normal2.js").then(({ default: value }) => {
expect(value).toBe(43);
});
});
}
|