diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 25a8007..6c0c393 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,9 +47,9 @@ jobs: architecture: ${{ steps.calculate_architecture.outputs.result }} cache: yarn - name: Install dependencies - run: yarn --frozen-lockfile + run: yarn --frozen-lockfile --ignore-engines - name: Run tests with coverage - run: yarn test --ci + run: yarn test --ci --coverage - uses: codecov/codecov-action@v5 with: flags: integration diff --git a/lib/__tests__/Hook.js b/lib/__tests__/Hook.js index 9ea7892..9d9d8e0 100644 --- a/lib/__tests__/Hook.js +++ b/lib/__tests__/Hook.js @@ -67,6 +67,31 @@ describe("Hook", () => { hook.call(); expect(calls).toEqual(["E", "F", "C", "D", "B", "A"]); }); + + it("should work with `withOptions`", () => { + const hook = new SyncHook(); + + const calls = []; + + hook + .withOptions({ + stage: -10 + }) + .tap("A", () => calls.push("A")); + + hook.tap( + { + name: "B", + stage: 0 + }, + () => calls.push("B") + ); + + calls.length = 0; + hook.call(); + expect(calls).toEqual(["A", "B"]); + }); + it("should throw without a valid name", () => { const hook = new SyncHook(); expect(() => hook.tap("", () => {})).toThrow(