Skip to content

Commit 79bbb35

Browse files
Merge pull request #832 from remarkablemark/dependabot/npm_and_yarn/actions/core-3.0.0
build(deps): bump @actions/core from 2.0.3 to 3.0.0
2 parents 5bf88a8 + 227dbb4 commit 79bbb35

File tree

7 files changed

+133
-40
lines changed

7 files changed

+133
-40
lines changed

dist/index.js

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

jest.config.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@ const config: Config = {
1010
statements: 100,
1111
},
1212
},
13-
preset: 'ts-jest',
13+
extensionsToTreatAsEsm: ['.ts'],
14+
moduleNameMapper: {
15+
'^(\\.{1,2}/.*)\\.js$': '$1',
16+
},
17+
transform: {
18+
'^.+\\.tsx?$': [
19+
'ts-jest',
20+
{
21+
useESM: true,
22+
},
23+
],
24+
},
1425
testEnvironment: 'node',
1526
};
1627

package-lock.json

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

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
"lint:fix": "npm run lint -- --fix",
1313
"lint:tsc": "tsc --noEmit",
1414
"prepare": "husky",
15-
"test": "jest",
16-
"test:ci": "CI=true jest --ci --colors --coverage",
17-
"test:watch": "jest --watch"
15+
"test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest",
16+
"test:ci": "CI=true npm test -- --ci --colors --coverage",
17+
"test:watch": "npm test -- --watch"
1818
},
1919
"dependencies": {
20-
"@actions/core": "2.0.3",
20+
"@actions/core": "3.0.0",
21+
"@actions/exec": "3.0.0",
2122
"@actions/tool-cache": "3.0.1"
2223
},
2324
"devDependencies": {

src/index.test.ts

Lines changed: 57 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,60 @@
1-
import os from 'node:os';
2-
3-
import * as core from '@actions/core';
4-
import * as exec from '@actions/exec';
5-
import * as tc from '@actions/tool-cache';
6-
7-
import { run } from '.';
8-
9-
jest.mock('@actions/core');
10-
jest.mock('@actions/exec');
11-
jest.mock('@actions/tool-cache');
12-
jest.mock('node:os');
13-
14-
const mockedCore = jest.mocked(core);
15-
const mockedExec = jest.mocked(exec);
16-
const mockedTc = jest.mocked(tc);
17-
const mockedOs = jest.mocked(os);
1+
import type { arch, platform } from 'node:os';
2+
3+
import type { addPath, getInput, setFailed } from '@actions/core';
4+
import type { exec } from '@actions/exec';
5+
import type {
6+
cacheFile,
7+
downloadTool,
8+
extractTar,
9+
extractZip,
10+
find,
11+
} from '@actions/tool-cache';
12+
import { jest } from '@jest/globals';
13+
14+
const mockedCore: {
15+
getInput: jest.MockedFunction<typeof getInput>;
16+
addPath: jest.MockedFunction<typeof addPath>;
17+
setFailed: jest.MockedFunction<typeof setFailed>;
18+
} = {
19+
getInput: jest.fn(),
20+
addPath: jest.fn(),
21+
setFailed: jest.fn(),
22+
};
23+
24+
const mockedExec: {
25+
exec: jest.MockedFunction<typeof exec>;
26+
} = {
27+
exec: jest.fn(),
28+
};
29+
30+
const mockedTc: {
31+
downloadTool: jest.MockedFunction<typeof downloadTool>;
32+
extractTar: jest.MockedFunction<typeof extractTar>;
33+
extractZip: jest.MockedFunction<typeof extractZip>;
34+
cacheFile: jest.MockedFunction<typeof cacheFile>;
35+
find: jest.MockedFunction<typeof find>;
36+
} = {
37+
downloadTool: jest.fn(),
38+
extractTar: jest.fn(),
39+
extractZip: jest.fn(),
40+
cacheFile: jest.fn(),
41+
find: jest.fn(),
42+
};
43+
44+
const mockedOs: {
45+
platform: jest.MockedFunction<typeof platform>;
46+
arch: jest.MockedFunction<typeof arch>;
47+
} = {
48+
platform: jest.fn(),
49+
arch: jest.fn(),
50+
};
51+
52+
jest.unstable_mockModule('@actions/core', () => mockedCore);
53+
jest.unstable_mockModule('@actions/exec', () => mockedExec);
54+
jest.unstable_mockModule('@actions/tool-cache', () => mockedTc);
55+
jest.unstable_mockModule('node:os', () => mockedOs);
56+
57+
const { run } = await import('./index.js');
1858

1959
beforeEach(() => {
2060
jest.resetAllMocks();

src/utils.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
import os from 'node:os';
1+
import { jest } from '@jest/globals';
22

3-
import { getBinaryPath, getDownloadObject } from './utils';
3+
const mockedOs = {
4+
platform: jest.fn(),
5+
arch: jest.fn(),
6+
};
47

5-
jest.mock('node:os');
6-
const mockedOs = jest.mocked(os);
8+
jest.unstable_mockModule('node:os', () => mockedOs);
9+
10+
const { getBinaryPath, getDownloadObject } = await import('./utils.js');
711

812
const platforms: NodeJS.Platform[] = ['darwin', 'linux', 'win32'];
913
const architectures = ['arm', 'x32', 'x64'] as NodeJS.Architecture[];

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"compilerOptions": {
3-
"target": "es2021",
3+
"target": "es2022",
4+
"module": "esnext",
45
"moduleResolution": "node",
56
"esModuleInterop": true,
67
"strict": true

0 commit comments

Comments
 (0)