/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/css/universal/index.js
47 строк
1 KB
hai-x
test: allow multiple bundle execution for universal targets (#20642)
16 мар 2026, 18:37
Не верифицирован
16 мар 2026, 18:37
47d4b55
Код
Авторство
О чём код?
import * as pureStyle from "./style.css"; import * as styles from "./style.modules.css"; it("should work", (done) => { expect(pureStyle).toEqual({}); if (typeof document !== "undefined") { const style = getComputedStyle(document.body); expect(style.getPropertyValue("background")).toBe(" red"); } expect(styles.foo).toBe("style_modules_css-foo"); import(/* webpackPrefetch: true */ "./style2.css").then((x) => { expect(x).toEqual({}); if (typeof document !== "undefined") { const style = getComputedStyle(document.body); expect(style.getPropertyValue("color")).toBe(" blue"); } import(/* webpackPrefetch: true */ "./style2.modules.css").then((x) => { expect(x.bar).toBe("style2_modules_css-bar"); done(); }, done); }, done); }); it("should work in web worker", async () => { if (typeof window !== "undefined") { const worker = new Worker(new URL("./worker.js", import.meta.url), { type: "module" }); worker.postMessage("ok"); const result = await new Promise((resolve) => { worker.onmessage = (event) => { resolve(event.data); }; }); expect(result).toBe( "data: style_modules_css-foo style2_modules_css-bar style3_modules_css-baz, thanks" ); await worker.terminate(); } else { expect(true).toBe(true); } });