Skip to content

Commit bd22c08

Browse files
fix: a regression
1 parent e687f9c commit bd22c08

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

.changeset/itchy-cycles-notice.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tapable": patch
3+
---
4+
5+
Revert ignore invalid `before` values.

lib/Hook.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,6 @@ class Hook {
152152
} else if (Array.isArray(item.before)) {
153153
before = new Set(item.before);
154154
}
155-
if (before) {
156-
for (const name of before) {
157-
if (!this.taps.some((tap) => tap.name === name)) {
158-
before.delete(name);
159-
}
160-
}
161-
}
162155
let stage = 0;
163156
if (typeof item.stage === "number") {
164157
stage = item.stage;

lib/__tests__/Hook.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ describe("Hook", () => {
108108
);
109109
});
110110

111-
it("should ignore invalid before values", () => {
111+
it("should not ignore invalid before values", () => {
112+
// A plugin may use a hook that will never be executed
112113
const hook = new SyncHook();
113114

114115
const calls = [];
@@ -126,7 +127,7 @@ describe("Hook", () => {
126127
hook.tap(
127128
{
128129
name: "C",
129-
before: [" "]
130+
before: ["Y"]
130131
},
131132
() => calls.push("C")
132133
);
@@ -149,6 +150,6 @@ describe("Hook", () => {
149150

150151
calls.length = 0;
151152
hook.call();
152-
expect(calls).toEqual(["A", "B", "C", "D", "E"]);
153+
expect(calls).toEqual(["C", "B", "A", "D", "E"]);
153154
});
154155
});

0 commit comments

Comments
 (0)