Upgrade jest and typescript

This commit is contained in:
Phill Sparks 2022-12-11 18:48:39 +00:00
parent b6d93d3b07
commit 8d3034bedb
No known key found for this signature in database
GPG Key ID: DA53DF9BB8928B10
6 changed files with 975 additions and 2101 deletions

View File

@ -6,36 +6,27 @@ test('runs quietly on success', () => {
process.env['INPUT_ELM_FORMAT'] = 'elm-format'
process.env['INPUT_ELM_FILES'] = '__tests__/elm/Good.elm'
const ip = path.join(__dirname, '..', 'lib', 'main.js')
const options: cp.ExecSyncOptions = {
env: process.env
const options: cp.SpawnOptions = {
env: process.env,
shell: true
}
let status
try {
cp.execSync(`node ${ip}`, options)
} catch (e) {
status = e.status
}
expect(status).toBeUndefined() // Success!
let ret = cp.spawnSync(`node ${ip}`, options)
expect(ret.status).toBe(0)
})
test('reports errors', () => {
process.env['INPUT_ELM_FORMAT'] = 'elm-format'
process.env['INPUT_ELM_FILES'] = '__tests__/elm/Bad.elm'
const ip = path.join(__dirname, '..', 'lib', 'main.js')
const options: cp.ExecSyncOptions = {
env: process.env
const options: cp.SpawnOptions = {
env: process.env,
shell: true
}
let stdout, status
try {
stdout = cp.execSync(`node ${ip}`, options)
} catch (e) {
status = e.status
stdout = e.stdout
}
expect(status).toBe(1)
expect(stdout.toString()).toBe(
let ret = cp.spawnSync(`node ${ip}`, options)
expect(ret.status).toBe(1)
expect(ret.stdout.toString()).toBe(
'::error file=__tests__/elm/Bad.elm::File is not formatted with elm-format-0.8.5 --elm-version=0.19\n' +
'::error::elm-format reported errors with 1 file\n'
)
@ -45,19 +36,14 @@ test('handles bad file input', () => {
process.env['INPUT_ELM_FORMAT'] = 'elm-format'
process.env['INPUT_ELM_FILES'] = '__tests__/elm/Missing.elm'
const ip = path.join(__dirname, '..', 'lib', 'main.js')
const options: cp.ExecSyncOptions = {
env: process.env
const options: cp.SpawnOptions = {
env: process.env,
shell: true
}
let status, stdout
try {
stdout = cp.execSync(`node ${ip}`, options)
} catch (e) {
status = e.status
stdout = e.stdout
}
expect(status).toBe(1) // Something went wrong
expect(stdout.toString()).toContain('::error::')
let ret = cp.spawnSync(`node ${ip}`, options)
expect(ret.status).toBe(1) // Something went wrong
expect(ret.stdout.toString()).toContain('::error::')
})
test('runs globs', () => {
@ -65,17 +51,13 @@ test('runs globs', () => {
process.env['INPUT_ELM_FILES'] = '__tests__/**/*.elm\n!**/Bad.elm'
process.env['INPUT_ELM_GLOB'] = 'true'
const ip = path.join(__dirname, '..', 'lib', 'main.js')
const options: cp.ExecSyncOptions = {
env: process.env
const options: cp.SpawnOptions = {
env: process.env,
shell: true
}
let status
try {
cp.execSync(`node ${ip}`, options)
} catch (e) {
status = e.status
}
expect(status).toBeUndefined() // Success!
let ret = cp.spawnSync(`node ${ip}`, options)
expect(ret.status).toBe(0) // Success!
})
test('handles no files input', () => {
@ -83,17 +65,12 @@ test('handles no files input', () => {
process.env['INPUT_ELM_FILES'] = 'Missing.elm'
process.env['INPUT_ELM_GLOB'] = 'true'
const ip = path.join(__dirname, '..', 'lib', 'main.js')
const options: cp.ExecSyncOptions = {
env: process.env
const options: cp.SpawnOptions = {
env: process.env,
shell: true
}
let status, stdout
try {
stdout = cp.execSync(`node ${ip}`, options)
} catch (e) {
status = e.status
stdout = e.stdout
}
expect(status).toBe(1) // Something went wrong
expect(stdout.toString()).toContain('::error::No Elm files found')
let ret = cp.spawnSync(`node ${ip}`, options)
expect(ret.status).toBe(1) // Something went wrong
expect(ret.stdout.toString()).toContain('::error::No Elm files found')
})

8
dist/index.js vendored
View File

@ -2676,7 +2676,11 @@ exports.checkBypass = checkBypass;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
@ -2753,7 +2757,7 @@ const runElmFormat = () => __awaiter(void 0, void 0, void 0, function* () {
const issueErrors = (report) => {
let reported = 0;
for (const message of report) {
command_1.issueCommand('error', { file: message.path }, message.message);
(0, command_1.issueCommand)('error', { file: message.path }, message.message);
reported++;
}
return reported;

View File

@ -33,8 +33,8 @@
"@actions/glob": "^0.3.0"
},
"devDependencies": {
"@types/jest": "^26.0.20",
"@types/node": "^14.14.20",
"@types/jest": "^29.2.4",
"@types/node": "^18.11.13",
"@typescript-eslint/parser": "^5.46.0",
"@zeit/ncc": "^0.22.3",
"elm-tooling": "^1.10.0",
@ -42,12 +42,12 @@
"eslint-plugin-github": "^4.6.0",
"eslint-plugin-jest": "^27.1.6",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"jest": "^29.3.1",
"jest-circus": "^29.3.1",
"js-yaml": "^4.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.2.1",
"ts-jest": "^26.4.4",
"typescript": "^4.1.3"
"ts-jest": "^29.0.3",
"typescript": "^4.9.4"
}
}

View File

@ -84,7 +84,7 @@ async function run(): Promise<void> {
const report = await runElmFormat()
reportFailure(issueErrors(report))
} catch (error) {
core.setFailed(error.message)
core.setFailed((error as Error).message)
}
}

View File

@ -1,13 +1,12 @@
{
"compilerOptions": {
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"outDir": "./lib", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
},
"exclude": ["node_modules"]
}
"compilerOptions": {
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"outDir": "./lib", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
},
"exclude": ["node_modules"]
}

2952
yarn.lock

File diff suppressed because it is too large Load Diff