From 26fa4456254b91be5f2cd064b76ecc0496bfd8c4 Mon Sep 17 00:00:00 2001 From: Martin Leduc <31558169+DecimalTurn@users.noreply.github.com> Date: Mon, 29 Sep 2025 19:20:07 +0000 Subject: [PATCH 1/5] Fix invalidfile test for Node Version 20 or higher --- src/tsconfig.spec.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/tsconfig.spec.ts b/src/tsconfig.spec.ts index 2444e24..f55f8bf 100644 --- a/src/tsconfig.spec.ts +++ b/src/tsconfig.spec.ts @@ -13,10 +13,21 @@ interface Test { } describe('tsconfig', function () { + + const nodeMajor = Number(process.version.match(/v(\d+)/)[1]); + let invalidJsonError; + if (nodeMajor >= 20) { + invalidJsonError = "Unexpected token 's', \"some random string\" is not valid JSON"; + } else if (nodeMajor >= 6) { + invalidJsonError = 'Unexpected token s in JSON at position 0'; + } else { + invalidJsonError = 'Unexpected token s'; + } + const tests: Test[] = [ { args: [TEST_DIR, 'invalidfile'], - error: parseInt(process.versions.node, 10) > 5 ? 'Unexpected token s in JSON at position 0' : 'Unexpected token s' + error: invalidJsonError }, { args: [TEST_DIR, 'missing'], From 457c71cc06af38b0d0fcce28ceefd062e6d23ed1 Mon Sep 17 00:00:00 2001 From: Martin Leduc <31558169+DecimalTurn@users.noreply.github.com> Date: Mon, 29 Sep 2025 20:14:30 +0000 Subject: [PATCH 2/5] Remove trailing whitespace and Unnecessary semicolons --- src/tsconfig.spec.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tsconfig.spec.ts b/src/tsconfig.spec.ts index f55f8bf..3f63d03 100644 --- a/src/tsconfig.spec.ts +++ b/src/tsconfig.spec.ts @@ -13,15 +13,15 @@ interface Test { } describe('tsconfig', function () { - - const nodeMajor = Number(process.version.match(/v(\d+)/)[1]); - let invalidJsonError; + + const nodeMajor = Number(process.version.match(/v(\d+)/)[1]) + let invalidJsonError if (nodeMajor >= 20) { - invalidJsonError = "Unexpected token 's', \"some random string\" is not valid JSON"; + invalidJsonError = "Unexpected token 's', \"some random string\" is not valid JSON" } else if (nodeMajor >= 6) { - invalidJsonError = 'Unexpected token s in JSON at position 0'; + invalidJsonError = 'Unexpected token s in JSON at position 0' } else { - invalidJsonError = 'Unexpected token s'; + invalidJsonError = 'Unexpected token s' } const tests: Test[] = [ From 3769bd215e7b16296acff14e02ec0dd90c79fcce Mon Sep 17 00:00:00 2001 From: Martin Leduc <31558169+DecimalTurn@users.noreply.github.com> Date: Wed, 1 Oct 2025 01:02:18 +0000 Subject: [PATCH 3/5] Add CI workflow for testing and building --- .github/workflows/ci.yml | 60 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b966724 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,60 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test: + timeout-minutes: 10 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + node: [18, 20, 22] + os: [ubuntu-latest, macos-latest, windows-latest] + include: + - node: 24 + os: ubuntu-latest + steps: + - name: Harden the runner # Inspired by https://github.com/dominikg/tsconfck + uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 + with: + egress-policy: block + allowed-endpoints: > + api.github.com:443 + github.com:443 + release-assets.githubusercontent.com:443 + registry.npmjs.org:443 + + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: 'false' + + - name: Setup Node.js + uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 + with: + node-version: ${{ matrix.node }} + cache: 'npm' + + - name: Install dependencies + run: npm i + + - name: Build + run: npm run build + + - name: Lint + if: ${{ !cancelled() }} + run: npm run lint + + - name: Test with coverage + if: ${{ !cancelled() }} + run: npm run test-cov + + - name: Test specs + if: ${{ !cancelled() }} + run: npm run test-spec \ No newline at end of file From 7bb106bd508e318f787f5b018cede9c3a608a15e Mon Sep 17 00:00:00 2001 From: Martin Leduc <31558169+DecimalTurn@users.noreply.github.com> Date: Wed, 1 Oct 2025 01:12:08 +0000 Subject: [PATCH 4/5] Avoid missing package-lock.json issue --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b966724..4d0762e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,6 @@ jobs: uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 with: node-version: ${{ matrix.node }} - cache: 'npm' - name: Install dependencies run: npm i From 35bee8c69af9ae5240f6109191a476dbe14a6e23 Mon Sep 17 00:00:00 2001 From: Martin Leduc <31558169+DecimalTurn@users.noreply.github.com> Date: Wed, 1 Oct 2025 01:12:29 +0000 Subject: [PATCH 5/5] Only do patch update for @types/chai and @types/node --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 935c07c..1a0a152 100644 --- a/package.json +++ b/package.json @@ -49,9 +49,9 @@ "strip-json-comments": "^2.0.0" }, "devDependencies": { - "@types/chai": "^4.0.4", + "@types/chai": " ~4.0.4", "@types/mocha": "^2.2.42", - "@types/node": "^8.0.25", + "@types/node": "~8.0.25", "bluebird": "^3.4.1", "chai": "^3.0.0", "istanbul": "^0.4.0",