Skip to content

fix: correct return value for serialHooks helper#1867

Merged
erickzhao merged 3 commits into
mainfrom
serial-hooks-fixed
Jan 16, 2026
Merged

fix: correct return value for serialHooks helper#1867
erickzhao merged 3 commits into
mainfrom
serial-hooks-fixed

Conversation

@erickzhao

Copy link
Copy Markdown
Member

This PR rewrites serialHooks to actually work as intended (by passing the resulting arg as a single mega-hook into Packager's options).

Usage would look something like this:

const opts = {
  afterCopy: serialHooks([
    async () => {}, // hook 1
    async () => {}, // hook 2
    async () => {}, // hook 3
  ])
}

@erickzhao erickzhao requested a review from a team as a code owner January 15, 2026 00:14
@malept

malept commented Jan 15, 2026

Copy link
Copy Markdown
Member

I don't suppose there's a reasonable way to add a regression test for this?

@erickzhao

erickzhao commented Jan 15, 2026

Copy link
Copy Markdown
Member Author

@malept I think I just wrote the serialHooks test wrong the first time while I was refactoring. The original problem was that I wrote serialHooks as an alternative to runHooks where it should actually be passed into the latter function. I think the test as-is should be good in catching regressions?

const serializedHooks = serialHooks(testHooks);
await runHooks(serializedHooks, {
buildPath: '',
electronVersion: '',
platform: 'darwin',
arch: 'arm64',
});
expect(output).toBe('0 1 2 3 4 5 6 7 8 9 10');
});

@malept

malept commented Jan 15, 2026

Copy link
Copy Markdown
Member

Ah OK, that makes sense.

@erickzhao erickzhao changed the title fix: correct function signature for serial hooks fix: correct return value for serialHooks helper Jan 16, 2026
@erickzhao erickzhao changed the title fix: correct return value for serialHooks helper fix: correct return value for serialHooks helper Jan 16, 2026
@erickzhao erickzhao merged commit 1914fb0 into main Jan 16, 2026
8 checks passed
@erickzhao erickzhao deleted the serial-hooks-fixed branch January 16, 2026 19:00
@electron-npm-package-publisher

Copy link
Copy Markdown

🎉 This PR is included in version 19.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants