Skip to content

Commit 540e4dd

Browse files
build(deps): bump @actions/tool-cache from 3.0.0 to 4.0.0 (#53)
* build(deps): bump @actions/tool-cache from 3.0.0 to 4.0.0 Bumps [@actions/tool-cache](https://github.com/actions/toolkit/tree/HEAD/packages/tool-cache) from 3.0.0 to 4.0.0. - [Changelog](https://github.com/actions/toolkit/blob/main/packages/tool-cache/RELEASES.md) - [Commits](https://github.com/actions/toolkit/commits/@actions/cache@4.0.0/packages/tool-cache) --- updated-dependencies: - dependency-name: "@actions/tool-cache" dependency-version: 4.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps): bump @actions/tool-cache from 3.0.0 to 4.0.0 Bumps [@actions/tool-cache](https://github.com/actions/toolkit/tree/HEAD/packages/tool-cache) from 3.0.0 to 4.0.0. - [Changelog](https://github.com/actions/toolkit/blob/main/packages/tool-cache/RELEASES.md) - [Commits](https://github.com/actions/toolkit/commits/@actions/cache@4.0.0/packages/tool-cache) --- updated-dependencies: - dependency-name: "@actions/tool-cache" dependency-version: 4.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * fix: support ESM in Jest --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Louis Bennett <louisbennett@users.noreply.github.com>
1 parent c5cbe99 commit 540e4dd

File tree

3 files changed

+67
-28
lines changed

3 files changed

+67
-28
lines changed

__tests__/index.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22
* Unit tests for the action's entrypoint, src/index.ts
33
*/
44

5-
import * as main from '../src/main'
5+
import { jest, describe, it, expect } from '@jest/globals'
66

7-
// Mock the action's entrypoint
8-
const runMock = jest.spyOn(main, 'run').mockImplementation()
7+
const runMock = jest.fn<() => Promise<void>>()
8+
9+
jest.unstable_mockModule('../src/main', () => ({
10+
run: runMock
11+
}))
912

1013
describe('index', () => {
1114
it('calls run when imported', async () => {
12-
// eslint-disable-next-line @typescript-eslint/no-require-imports
13-
require('../src/index')
15+
await import('../src/index')
1416

1517
expect(runMock).toHaveBeenCalled()
1618
})

package-lock.json

Lines changed: 56 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
"format:check": "prettier --check **/*.ts",
2727
"lint": "npx eslint",
2828
"package": "ncc build src/index.ts",
29-
"test": "jest"
29+
"test": "NODE_OPTIONS='--experimental-vm-modules' jest"
3030
},
3131
"jest": {
32-
"preset": "ts-jest",
3332
"verbose": true,
3433
"clearMocks": true,
3534
"testEnvironment": "node",
35+
"extensionsToTreatAsEsm": [".ts"],
3636
"moduleFileExtensions": [
3737
"js",
3838
"ts"
@@ -45,13 +45,13 @@
4545
"/dist/"
4646
],
4747
"transform": {
48-
"^.+\\.ts$": "ts-jest"
48+
"^.+\\.ts$": ["ts-jest", { "useESM": true }]
4949
}
5050
},
5151
"dependencies": {
5252
"@actions/core": "^2.0.1",
5353
"@actions/github": "^6.0.1",
54-
"@actions/tool-cache": "^3.0.0",
54+
"@actions/tool-cache": "^4.0.0",
5555
"semver": "^7.7.4"
5656
},
5757
"devDependencies": {

0 commit comments

Comments
 (0)