From 8fce4e6ab0dc0a994c5558e57bbb17078da4b90b Mon Sep 17 00:00:00 2001 From: itvi-1234 Date: Sat, 5 Dec 2026 11:34:33 +0530 Subject: [PATCH] Run the publish tests by file path so they work on every Node version Node 22 and 24 read a directory passed to --test as a module path and fail, while Node 20 has no glob support. Naming the test file works on all of them. --- .github/workflows/ci.yml | 2 +- .github/workflows/publish-npm.yml | 2 +- docs/releases.md | 2 +- scripts/publish-npm.test.mjs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b869e0..486cc68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,4 +31,4 @@ jobs: - run: npm run build - name: Test the publish script if: matrix.dir == '.' - run: node --test scripts/ + run: node --test scripts/publish-npm.test.mjs diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index be59f6a..e9ee816 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -54,7 +54,7 @@ jobs: run: npm install --global npm@11.15.0 - name: Test the publish script - run: node --test scripts/ + run: node --test scripts/publish-npm.test.mjs - name: Build and check both packages, then publish or stage them id: publish diff --git a/docs/releases.md b/docs/releases.md index fb092b8..8475472 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -27,7 +27,7 @@ the same version, the way the extensions repository publishes its bindings. | The version is already there | Skips it. | | Anything else | Publishes through npm trusted publishing. No token is used. | -The logic is in `scripts/publish-npm.mjs`, tested with `node --test scripts/`. +The logic is in `scripts/publish-npm.mjs`, tested with `node --test scripts/publish-npm.test.mjs`. ## One-time setup diff --git a/scripts/publish-npm.test.mjs b/scripts/publish-npm.test.mjs index 312516f..0a51490 100644 --- a/scripts/publish-npm.test.mjs +++ b/scripts/publish-npm.test.mjs @@ -1,4 +1,4 @@ -// Run with: node --test scripts/ +// Run with: node --test scripts/publish-npm.test.mjs import assert from 'node:assert/strict'; import { mkdirSync, mkdtempSync, writeFileSync } from 'node:fs'; import { tmpdir } from 'node:os';