diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c1ce1d7..db324cc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,9 +28,5 @@ jobs: npm install -g eslint - name: Run Test (Should Fail) - run: | - npm test - exitcode="$?" - echo "exitcode=$exitcode" - exit "$exitcode" + run: npm test diff --git a/package.json b/package.json index f4fd0fb..def182a 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "version": "1.0.0", "main": "eslint-config-cityssm.js", "scripts": { - "test": "eslint test/**" + "test": "node ./test/runEslint.mjs" }, "keywords": [ "eslint-config" @@ -33,5 +33,7 @@ }, "devDependencies": { "@types/node": "^20.10.0" + "@types/node": "^20.10.0", + "execa": "^8.0.1" } } diff --git a/test/runEslint.mjs b/test/runEslint.mjs new file mode 100644 index 0000000..9577997 --- /dev/null +++ b/test/runEslint.mjs @@ -0,0 +1,5 @@ +import { execa } from 'execa'; +// eslint-disable-next-line unicorn/prefer-top-level-await +execa('eslint --exit-on-fatal-error test/test.ts', { stdio: 'inherit' }).catch((error) => { + process.exitCode = error.exitCode === 1 ? 0 : 1; +}); diff --git a/test/runEslint.mts b/test/runEslint.mts new file mode 100644 index 0000000..16c44eb --- /dev/null +++ b/test/runEslint.mts @@ -0,0 +1,8 @@ +import { execa } from 'execa' + +// eslint-disable-next-line unicorn/prefer-top-level-await +execa('eslint --exit-on-fatal-error test/test.ts', { stdio: 'inherit' }).catch( + (error) => { + process.exitCode = error.exitCode === 1 ? 0 : 1 + } +)