Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions lib/__tests__/Hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down