/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/css/css-modules/index.js
35 строк
1 KB
Alexander Akait
fix: circular css modules extra hashes
08 май 2026, 15:21
Не верифицирован
08 май 2026, 15:21
d21b845
Код
Авторство
О чём код?
const prod = process.env.NODE_ENV === "production"; it("should allow to create css modules", done => { import("./use-style.js").then(({ default: x }) => { try { expect(x).toMatchSnapshot(prod ? "prod" : "dev"); const fs = __non_webpack_require__("fs"); const path = __non_webpack_require__("path"); if (__STATS_I__ === 0 || __STATS_I__ === 1) { let cssOutputFilename; if (prod) { const files = fs.readdirSync(__dirname); cssOutputFilename = files.find(f => /^\d+\.bundle1\.css$/.test(f)); if (!cssOutputFilename) { throw new Error( `No production CSS chunk matching /^\\d+\\.bundle1\\.css$/ found in ${__dirname}. Files: ${files.join(", ")}` ); } } else { cssOutputFilename = `use-style_js.bundle${__STATS_I__}.css`; } const cssContent = fs.readFileSync( path.join(__dirname, cssOutputFilename), "utf-8" ); expect(cssContent).toMatchSnapshot(prod ? "prod" : "dev"); } } catch (e) { return done(e); } done(); }, done); });