Skip to content

Migrate to esm#363

Open
pbrisbin wants to merge 3 commits intomainfrom
pb/esm
Open

Migrate to esm#363
pbrisbin wants to merge 3 commits intomainfrom
pb/esm

Conversation

@pbrisbin
Copy link
Copy Markdown
Member

fix: migrate to esm module

825a3d6

In order to use dependencies that are esm modules (which @actions/*
just did), we have to be an esm module ourselves.

Note that this doesn't work yet; esm modules break jest's mocking.
This'll be addressed in future commits.

chore: replace jest mock with dep injection

ebe8dbd

We can't mock that way with esm dependencies1. There are some
workarounds, but nothing worked, so I decided to introduce my own
interface and dependency injection.

In the exec module, apparently, we used to do it this way; there was
an old (unused) ExecDelegate interface. When implementing withCache,
I tried to follow that naming and test definition style, balanced
against reducing the diff with main.

chore: introduce CacheOptions{silent} to avoid logging in tests

1be63c3

Now that it's an esm module, we can't mock core like we were.

Footnotes

  1. https://github.com/jestjs/jest/issues/10025

In order to use dependencies that are esm modules (which `@actions/*`
just did), we have to be an esm module ourselves.

Note that this doesn't work yet; esm modules break jest's mocking.
This'll be addressed in future commits.
We can't mock that way with esm dependencies[^1]. There are some
workarounds, but nothing worked, so I decided to introduce my own
interface and dependency injection.

In the `exec` module, apparently, we used to do it this way; there was
an old (unused) `ExecDelegate` interface. When implementing `withCache`,
I tried to follow that naming and test definition style, balanced
against reducing the diff with `main`.

[^1]: jestjs/jest#10025
Now that it's an esm module, we can't mock `core` like we were.
@pbrisbin pbrisbin changed the title chore: introduce CacheOptions{silent} to avoid logging in tests Migrate to esm Mar 27, 2026
@pbrisbin pbrisbin marked this pull request as ready for review March 27, 2026 14:34
@pbrisbin pbrisbin requested a review from a team as a code owner March 27, 2026 14:34
@pbrisbin pbrisbin requested review from mjgpy3 and removed request for a team March 27, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant