mirror of
https://github.com/threeal/cmake-action.git
synced 2025-07-03 05:31:21 +00:00
test: strict TypeScript ESLint configuration (#744)
* test: enable strict TypeScript ESLint configuration Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com> * test: convert ESLint configuration to TypeScript Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com> --------- Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>
This commit is contained in:
parent
54f1f8eb66
commit
a5cd911f7b
4
dist/action.mjs
generated
vendored
4
dist/action.mjs
generated
vendored
@ -82,7 +82,7 @@ async function exec(command, args) {
|
|||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
reject(new Error(`Command exited with status code ${code}`));
|
reject(new Error(`Command exited with status code ${code.toString()}`));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -136,7 +136,7 @@ function parse(str) {
|
|||||||
const args = [];
|
const args = [];
|
||||||
let match;
|
let match;
|
||||||
while ((match = regex.exec(str)) !== null) {
|
while ((match = regex.exec(str)) !== null) {
|
||||||
args.push(match[1] ?? match[2] ?? match[3] ?? match[4]);
|
args.push(match[1] || match[2] || match[3] || match[4]);
|
||||||
}
|
}
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
import eslint from "@eslint/js";
|
|
||||||
import tseslint from "typescript-eslint";
|
|
||||||
|
|
||||||
export default [
|
|
||||||
eslint.configs.recommended,
|
|
||||||
...tseslint.configs.recommended,
|
|
||||||
...tseslint.configs.stylistic,
|
|
||||||
{ ignores: ["dist"] },
|
|
||||||
];
|
|
20
eslint.config.ts
Normal file
20
eslint.config.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import eslint from "@eslint/js";
|
||||||
|
import { globalIgnores } from "eslint/config";
|
||||||
|
import tseslint from "typescript-eslint";
|
||||||
|
|
||||||
|
export default tseslint.config(
|
||||||
|
globalIgnores(["dist"]),
|
||||||
|
eslint.configs.recommended,
|
||||||
|
tseslint.configs.strictTypeChecked,
|
||||||
|
tseslint.configs.stylisticTypeChecked,
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
|
parserOptions: {
|
||||||
|
projectService: {
|
||||||
|
allowDefaultProject: ["rollup.config.js"],
|
||||||
|
},
|
||||||
|
tsconfigRootDir: import.meta.dirname,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
@ -16,6 +16,7 @@
|
|||||||
"@types/node": "^22.15.30",
|
"@types/node": "^22.15.30",
|
||||||
"@vitest/coverage-v8": "^3.1.4",
|
"@vitest/coverage-v8": "^3.1.4",
|
||||||
"eslint": "^9.28.0",
|
"eslint": "^9.28.0",
|
||||||
|
"jiti": "^2.4.2",
|
||||||
"lefthook": "^1.11.14",
|
"lefthook": "^1.11.14",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"rollup": "^4.41.1",
|
"rollup": "^4.41.1",
|
||||||
|
86
pnpm-lock.yaml
generated
86
pnpm-lock.yaml
generated
@ -29,10 +29,13 @@ importers:
|
|||||||
version: 22.15.30
|
version: 22.15.30
|
||||||
'@vitest/coverage-v8':
|
'@vitest/coverage-v8':
|
||||||
specifier: ^3.1.4
|
specifier: ^3.1.4
|
||||||
version: 3.1.4(vitest@3.1.4(@types/node@22.15.30))
|
version: 3.1.4(vitest@3.1.4(@types/node@22.15.30)(jiti@2.4.2))
|
||||||
eslint:
|
eslint:
|
||||||
specifier: ^9.28.0
|
specifier: ^9.28.0
|
||||||
version: 9.28.0
|
version: 9.28.0(jiti@2.4.2)
|
||||||
|
jiti:
|
||||||
|
specifier: ^2.4.2
|
||||||
|
version: 2.4.2
|
||||||
lefthook:
|
lefthook:
|
||||||
specifier: ^1.11.14
|
specifier: ^1.11.14
|
||||||
version: 1.11.14
|
version: 1.11.14
|
||||||
@ -50,10 +53,10 @@ importers:
|
|||||||
version: 5.8.3
|
version: 5.8.3
|
||||||
typescript-eslint:
|
typescript-eslint:
|
||||||
specifier: ^8.33.1
|
specifier: ^8.33.1
|
||||||
version: 8.33.1(eslint@9.28.0)(typescript@5.8.3)
|
version: 8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3)
|
||||||
vitest:
|
vitest:
|
||||||
specifier: ^3.1.4
|
specifier: ^3.1.4
|
||||||
version: 3.1.4(@types/node@22.15.30)
|
version: 3.1.4(@types/node@22.15.30)(jiti@2.4.2)
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
|
|
||||||
@ -900,6 +903,10 @@ packages:
|
|||||||
jackspeak@3.4.3:
|
jackspeak@3.4.3:
|
||||||
resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==}
|
resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==}
|
||||||
|
|
||||||
|
jiti@2.4.2:
|
||||||
|
resolution: {integrity: sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
js-yaml@4.1.0:
|
js-yaml@4.1.0:
|
||||||
resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==}
|
resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
@ -1435,9 +1442,9 @@ snapshots:
|
|||||||
'@esbuild/win32-x64@0.25.0':
|
'@esbuild/win32-x64@0.25.0':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@eslint-community/eslint-utils@4.7.0(eslint@9.28.0)':
|
'@eslint-community/eslint-utils@4.7.0(eslint@9.28.0(jiti@2.4.2))':
|
||||||
dependencies:
|
dependencies:
|
||||||
eslint: 9.28.0
|
eslint: 9.28.0(jiti@2.4.2)
|
||||||
eslint-visitor-keys: 3.4.3
|
eslint-visitor-keys: 3.4.3
|
||||||
|
|
||||||
'@eslint-community/regexpp@4.12.1': {}
|
'@eslint-community/regexpp@4.12.1': {}
|
||||||
@ -1634,15 +1641,15 @@ snapshots:
|
|||||||
|
|
||||||
'@types/resolve@1.20.2': {}
|
'@types/resolve@1.20.2': {}
|
||||||
|
|
||||||
'@typescript-eslint/eslint-plugin@8.33.1(@typescript-eslint/parser@8.33.1(eslint@9.28.0)(typescript@5.8.3))(eslint@9.28.0)(typescript@5.8.3)':
|
'@typescript-eslint/eslint-plugin@8.33.1(@typescript-eslint/parser@8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@eslint-community/regexpp': 4.12.1
|
'@eslint-community/regexpp': 4.12.1
|
||||||
'@typescript-eslint/parser': 8.33.1(eslint@9.28.0)(typescript@5.8.3)
|
'@typescript-eslint/parser': 8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3)
|
||||||
'@typescript-eslint/scope-manager': 8.33.1
|
'@typescript-eslint/scope-manager': 8.33.1
|
||||||
'@typescript-eslint/type-utils': 8.33.1(eslint@9.28.0)(typescript@5.8.3)
|
'@typescript-eslint/type-utils': 8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3)
|
||||||
'@typescript-eslint/utils': 8.33.1(eslint@9.28.0)(typescript@5.8.3)
|
'@typescript-eslint/utils': 8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3)
|
||||||
'@typescript-eslint/visitor-keys': 8.33.1
|
'@typescript-eslint/visitor-keys': 8.33.1
|
||||||
eslint: 9.28.0
|
eslint: 9.28.0(jiti@2.4.2)
|
||||||
graphemer: 1.4.0
|
graphemer: 1.4.0
|
||||||
ignore: 7.0.5
|
ignore: 7.0.5
|
||||||
natural-compare: 1.4.0
|
natural-compare: 1.4.0
|
||||||
@ -1651,14 +1658,14 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/parser@8.33.1(eslint@9.28.0)(typescript@5.8.3)':
|
'@typescript-eslint/parser@8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/scope-manager': 8.33.1
|
'@typescript-eslint/scope-manager': 8.33.1
|
||||||
'@typescript-eslint/types': 8.33.1
|
'@typescript-eslint/types': 8.33.1
|
||||||
'@typescript-eslint/typescript-estree': 8.33.1(typescript@5.8.3)
|
'@typescript-eslint/typescript-estree': 8.33.1(typescript@5.8.3)
|
||||||
'@typescript-eslint/visitor-keys': 8.33.1
|
'@typescript-eslint/visitor-keys': 8.33.1
|
||||||
debug: 4.4.1
|
debug: 4.4.1
|
||||||
eslint: 9.28.0
|
eslint: 9.28.0(jiti@2.4.2)
|
||||||
typescript: 5.8.3
|
typescript: 5.8.3
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
@ -1681,12 +1688,12 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
typescript: 5.8.3
|
typescript: 5.8.3
|
||||||
|
|
||||||
'@typescript-eslint/type-utils@8.33.1(eslint@9.28.0)(typescript@5.8.3)':
|
'@typescript-eslint/type-utils@8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/typescript-estree': 8.33.1(typescript@5.8.3)
|
'@typescript-eslint/typescript-estree': 8.33.1(typescript@5.8.3)
|
||||||
'@typescript-eslint/utils': 8.33.1(eslint@9.28.0)(typescript@5.8.3)
|
'@typescript-eslint/utils': 8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3)
|
||||||
debug: 4.4.1
|
debug: 4.4.1
|
||||||
eslint: 9.28.0
|
eslint: 9.28.0(jiti@2.4.2)
|
||||||
ts-api-utils: 2.1.0(typescript@5.8.3)
|
ts-api-utils: 2.1.0(typescript@5.8.3)
|
||||||
typescript: 5.8.3
|
typescript: 5.8.3
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
@ -1710,13 +1717,13 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/utils@8.33.1(eslint@9.28.0)(typescript@5.8.3)':
|
'@typescript-eslint/utils@8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@eslint-community/eslint-utils': 4.7.0(eslint@9.28.0)
|
'@eslint-community/eslint-utils': 4.7.0(eslint@9.28.0(jiti@2.4.2))
|
||||||
'@typescript-eslint/scope-manager': 8.33.1
|
'@typescript-eslint/scope-manager': 8.33.1
|
||||||
'@typescript-eslint/types': 8.33.1
|
'@typescript-eslint/types': 8.33.1
|
||||||
'@typescript-eslint/typescript-estree': 8.33.1(typescript@5.8.3)
|
'@typescript-eslint/typescript-estree': 8.33.1(typescript@5.8.3)
|
||||||
eslint: 9.28.0
|
eslint: 9.28.0(jiti@2.4.2)
|
||||||
typescript: 5.8.3
|
typescript: 5.8.3
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
@ -1726,7 +1733,7 @@ snapshots:
|
|||||||
'@typescript-eslint/types': 8.33.1
|
'@typescript-eslint/types': 8.33.1
|
||||||
eslint-visitor-keys: 4.2.0
|
eslint-visitor-keys: 4.2.0
|
||||||
|
|
||||||
'@vitest/coverage-v8@3.1.4(vitest@3.1.4(@types/node@22.15.30))':
|
'@vitest/coverage-v8@3.1.4(vitest@3.1.4(@types/node@22.15.30)(jiti@2.4.2))':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@ampproject/remapping': 2.3.0
|
'@ampproject/remapping': 2.3.0
|
||||||
'@bcoe/v8-coverage': 1.0.2
|
'@bcoe/v8-coverage': 1.0.2
|
||||||
@ -1740,7 +1747,7 @@ snapshots:
|
|||||||
std-env: 3.9.0
|
std-env: 3.9.0
|
||||||
test-exclude: 7.0.1
|
test-exclude: 7.0.1
|
||||||
tinyrainbow: 2.0.0
|
tinyrainbow: 2.0.0
|
||||||
vitest: 3.1.4(@types/node@22.15.30)
|
vitest: 3.1.4(@types/node@22.15.30)(jiti@2.4.2)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
@ -1751,13 +1758,13 @@ snapshots:
|
|||||||
chai: 5.2.0
|
chai: 5.2.0
|
||||||
tinyrainbow: 2.0.0
|
tinyrainbow: 2.0.0
|
||||||
|
|
||||||
'@vitest/mocker@3.1.4(vite@6.2.0(@types/node@22.15.30))':
|
'@vitest/mocker@3.1.4(vite@6.2.0(@types/node@22.15.30)(jiti@2.4.2))':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@vitest/spy': 3.1.4
|
'@vitest/spy': 3.1.4
|
||||||
estree-walker: 3.0.3
|
estree-walker: 3.0.3
|
||||||
magic-string: 0.30.17
|
magic-string: 0.30.17
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
vite: 6.2.0(@types/node@22.15.30)
|
vite: 6.2.0(@types/node@22.15.30)(jiti@2.4.2)
|
||||||
|
|
||||||
'@vitest/pretty-format@3.1.4':
|
'@vitest/pretty-format@3.1.4':
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -1916,9 +1923,9 @@ snapshots:
|
|||||||
|
|
||||||
eslint-visitor-keys@4.2.0: {}
|
eslint-visitor-keys@4.2.0: {}
|
||||||
|
|
||||||
eslint@9.28.0:
|
eslint@9.28.0(jiti@2.4.2):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@eslint-community/eslint-utils': 4.7.0(eslint@9.28.0)
|
'@eslint-community/eslint-utils': 4.7.0(eslint@9.28.0(jiti@2.4.2))
|
||||||
'@eslint-community/regexpp': 4.12.1
|
'@eslint-community/regexpp': 4.12.1
|
||||||
'@eslint/config-array': 0.20.0
|
'@eslint/config-array': 0.20.0
|
||||||
'@eslint/config-helpers': 0.2.2
|
'@eslint/config-helpers': 0.2.2
|
||||||
@ -1953,6 +1960,8 @@ snapshots:
|
|||||||
minimatch: 3.1.2
|
minimatch: 3.1.2
|
||||||
natural-compare: 1.4.0
|
natural-compare: 1.4.0
|
||||||
optionator: 0.9.4
|
optionator: 0.9.4
|
||||||
|
optionalDependencies:
|
||||||
|
jiti: 2.4.2
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
@ -2121,6 +2130,8 @@ snapshots:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@pkgjs/parseargs': 0.11.0
|
'@pkgjs/parseargs': 0.11.0
|
||||||
|
|
||||||
|
jiti@2.4.2: {}
|
||||||
|
|
||||||
js-yaml@4.1.0:
|
js-yaml@4.1.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
argparse: 2.0.1
|
argparse: 2.0.1
|
||||||
@ -2409,12 +2420,12 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
prelude-ls: 1.2.1
|
prelude-ls: 1.2.1
|
||||||
|
|
||||||
typescript-eslint@8.33.1(eslint@9.28.0)(typescript@5.8.3):
|
typescript-eslint@8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/eslint-plugin': 8.33.1(@typescript-eslint/parser@8.33.1(eslint@9.28.0)(typescript@5.8.3))(eslint@9.28.0)(typescript@5.8.3)
|
'@typescript-eslint/eslint-plugin': 8.33.1(@typescript-eslint/parser@8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3)
|
||||||
'@typescript-eslint/parser': 8.33.1(eslint@9.28.0)(typescript@5.8.3)
|
'@typescript-eslint/parser': 8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3)
|
||||||
'@typescript-eslint/utils': 8.33.1(eslint@9.28.0)(typescript@5.8.3)
|
'@typescript-eslint/utils': 8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3)
|
||||||
eslint: 9.28.0
|
eslint: 9.28.0(jiti@2.4.2)
|
||||||
typescript: 5.8.3
|
typescript: 5.8.3
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
@ -2427,13 +2438,13 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
punycode: 2.3.1
|
punycode: 2.3.1
|
||||||
|
|
||||||
vite-node@3.1.4(@types/node@22.15.30):
|
vite-node@3.1.4(@types/node@22.15.30)(jiti@2.4.2):
|
||||||
dependencies:
|
dependencies:
|
||||||
cac: 6.7.14
|
cac: 6.7.14
|
||||||
debug: 4.4.1
|
debug: 4.4.1
|
||||||
es-module-lexer: 1.7.0
|
es-module-lexer: 1.7.0
|
||||||
pathe: 2.0.3
|
pathe: 2.0.3
|
||||||
vite: 6.2.0(@types/node@22.15.30)
|
vite: 6.2.0(@types/node@22.15.30)(jiti@2.4.2)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- '@types/node'
|
- '@types/node'
|
||||||
- jiti
|
- jiti
|
||||||
@ -2448,7 +2459,7 @@ snapshots:
|
|||||||
- tsx
|
- tsx
|
||||||
- yaml
|
- yaml
|
||||||
|
|
||||||
vite@6.2.0(@types/node@22.15.30):
|
vite@6.2.0(@types/node@22.15.30)(jiti@2.4.2):
|
||||||
dependencies:
|
dependencies:
|
||||||
esbuild: 0.25.0
|
esbuild: 0.25.0
|
||||||
postcss: 8.5.3
|
postcss: 8.5.3
|
||||||
@ -2456,11 +2467,12 @@ snapshots:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@types/node': 22.15.30
|
'@types/node': 22.15.30
|
||||||
fsevents: 2.3.3
|
fsevents: 2.3.3
|
||||||
|
jiti: 2.4.2
|
||||||
|
|
||||||
vitest@3.1.4(@types/node@22.15.30):
|
vitest@3.1.4(@types/node@22.15.30)(jiti@2.4.2):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@vitest/expect': 3.1.4
|
'@vitest/expect': 3.1.4
|
||||||
'@vitest/mocker': 3.1.4(vite@6.2.0(@types/node@22.15.30))
|
'@vitest/mocker': 3.1.4(vite@6.2.0(@types/node@22.15.30)(jiti@2.4.2))
|
||||||
'@vitest/pretty-format': 3.1.4
|
'@vitest/pretty-format': 3.1.4
|
||||||
'@vitest/runner': 3.1.4
|
'@vitest/runner': 3.1.4
|
||||||
'@vitest/snapshot': 3.1.4
|
'@vitest/snapshot': 3.1.4
|
||||||
@ -2477,8 +2489,8 @@ snapshots:
|
|||||||
tinyglobby: 0.2.14
|
tinyglobby: 0.2.14
|
||||||
tinypool: 1.0.2
|
tinypool: 1.0.2
|
||||||
tinyrainbow: 2.0.0
|
tinyrainbow: 2.0.0
|
||||||
vite: 6.2.0(@types/node@22.15.30)
|
vite: 6.2.0(@types/node@22.15.30)(jiti@2.4.2)
|
||||||
vite-node: 3.1.4(@types/node@22.15.30)
|
vite-node: 3.1.4(@types/node@22.15.30)(jiti@2.4.2)
|
||||||
why-is-node-running: 2.3.0
|
why-is-node-running: 2.3.0
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@types/node': 22.15.30
|
'@types/node': 22.15.30
|
||||||
|
@ -183,7 +183,7 @@ describe("get action context", () => {
|
|||||||
const { getInput } = await import("gha-utils");
|
const { getInput } = await import("gha-utils");
|
||||||
const { getContext } = await import("./context.js");
|
const { getContext } = await import("./context.js");
|
||||||
|
|
||||||
const inputs = testCase.inputs || {};
|
const inputs = testCase.inputs ?? {};
|
||||||
vi.mocked(getInput).mockImplementation((name) => inputs[name] ?? "");
|
vi.mocked(getInput).mockImplementation((name) => inputs[name] ?? "");
|
||||||
|
|
||||||
expect(getContext()).toStrictEqual({
|
expect(getContext()).toStrictEqual({
|
||||||
|
@ -17,11 +17,11 @@ export async function exec(command: string, args: string[]): Promise<void> {
|
|||||||
});
|
});
|
||||||
logCommand(proc.spawnfile, ...proc.spawnargs.splice(1));
|
logCommand(proc.spawnfile, ...proc.spawnargs.splice(1));
|
||||||
proc.on("error", reject);
|
proc.on("error", reject);
|
||||||
proc.on("close", (code) => {
|
proc.on("close", (code: number) => {
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
resolve();
|
resolve();
|
||||||
} else {
|
} else {
|
||||||
reject(new Error(`Command exited with status code ${code}`));
|
reject(new Error(`Command exited with status code ${code.toString()}`));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -12,7 +12,7 @@ export function parse(str: string): string[] {
|
|||||||
const args: string[] = [];
|
const args: string[] = [];
|
||||||
let match: RegExpExecArray | null;
|
let match: RegExpExecArray | null;
|
||||||
while ((match = regex.exec(str)) !== null) {
|
while ((match = regex.exec(str)) !== null) {
|
||||||
args.push(match[1] ?? match[2] ?? match[3] ?? match[4]);
|
args.push(match[1] || match[2] || match[3] || match[4]);
|
||||||
}
|
}
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user