/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v5.100.2
test/Watch.test.js
61 строка
1 KB
Alexander Akait
chore: eslint more rules (#19648)
03 июл 2025, 12:06
Не верифицирован
03 июл 2025, 12:06
87f648e
Код
Авторство
О чём код?
"use strict"; require("./helpers/warmup-webpack"); const path = require("path"); const { Volume, createFsFromVolume } = require("memfs"); const webpack = require(".."); jest.setTimeout(10000); describe("Watch", () => { it("should only compile a single time", done => { let counterBeforeCompile = 0; let counterDone = 0; let counterHandler = 0; const compiler = webpack( { context: path.resolve(__dirname, "fixtures/watch"), watch: true, mode: "development", snapshot: { managedPaths: [/^(.+?[\\/]node_modules[\\/])/] }, experiments: { futureDefaults: true }, module: { // unsafeCache: false, rules: [ { test: /\.js$/, use: "some-loader" } ] }, plugins: [ c => { c.hooks.beforeCompile.tap("test", () => { counterBeforeCompile++; }); c.hooks.done.tap("test", () => { counterDone++; }); } ] }, (err, stats) => { if (err) return done(err); if (stats.hasErrors()) return done(new Error(stats.toString())); counterHandler++; } ); compiler.outputFileSystem = createFsFromVolume(new Volume()); setTimeout(() => { expect(counterBeforeCompile).toBe(1); expect(counterDone).toBe(1); expect(counterHandler).toBe(1); compiler.close(done); }, 5000); }); });