tapable/lib/__tests__/HookStackOverflow.js
2025-06-11 04:07:02 +03:00

20 lines
502 B
JavaScript

"use strict";
const AsyncSeriesHook = require("../AsyncSeriesHook");
describe("HookStackOverflow", () => {
it("should not crash when compiling a large hook", () => {
const hook = new AsyncSeriesHook(["a", "b"]);
for (let i = 0; i < 10; i++) {
hook.tap("TestPlugin", (_a, _b) => {});
hook.tapAsync("TestPlugin", (a, b, callback) => callback());
hook.tapPromise("TestPlugin", (_a, _b) => Promise.resolve());
}
expect(hook.taps).toBeDefined();
return hook.promise(1, 2);
});
});