From ec9ca77c10a429dda31f09709ccc5fb5797afe1b Mon Sep 17 00:00:00 2001 From: Tamir Dresher Date: Sat, 28 Mar 2026 18:15:48 +0300 Subject: [PATCH] fix(ci): rename node:test files to .cjs for ESM compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The root package.json has "type": "module" but the 9 node:test files used require() (CommonJS). Node.js treats .js files as ESM in module-type packages, causing all tests to fail with: ReferenceError: require is not defined in ES module scope This broke Squad Release, Squad Preview, and Squad Insider Release workflows on every push to main since the ESM migration. Fix: rename *.test.js -> *.test.cjs (explicit CommonJS) and update all workflow globs from test/*.test.js to test/*.test.cjs. Zero logic changes — only file extensions and glob patterns. Vitest is unaffected (its config only includes test/**/*.test.ts). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/squad-insider-release.yml | 2 +- .github/workflows/squad-preview.yml | 2 +- .github/workflows/squad-release.yml | 2 +- .squad-templates/workflows/squad-ci.yml | 2 +- .squad-templates/workflows/squad-insider-release.yml | 2 +- .squad-templates/workflows/squad-preview.yml | 2 +- .squad-templates/workflows/squad-release.yml | 2 +- packages/squad-cli/templates/workflows/squad-ci.yml | 2 +- .../squad-cli/templates/workflows/squad-insider-release.yml | 2 +- packages/squad-cli/templates/workflows/squad-preview.yml | 2 +- packages/squad-cli/templates/workflows/squad-release.yml | 2 +- packages/squad-sdk/templates/workflows/squad-ci.yml | 2 +- .../squad-sdk/templates/workflows/squad-insider-release.yml | 2 +- packages/squad-sdk/templates/workflows/squad-preview.yml | 2 +- packages/squad-sdk/templates/workflows/squad-release.yml | 2 +- templates/workflows/squad-ci.yml | 2 +- templates/workflows/squad-insider-release.yml | 2 +- templates/workflows/squad-preview.yml | 2 +- templates/workflows/squad-release.yml | 2 +- test/{email-scrub.test.js => email-scrub.test.cjs} | 0 test/{init-flow.test.js => init-flow.test.cjs} | 0 test/{mcp-config.test.js => mcp-config.test.cjs} | 0 test/{migrate-directory.test.js => migrate-directory.test.cjs} | 0 .../{plugin-marketplace.test.js => plugin-marketplace.test.cjs} | 0 test/{rework-rate.test.js => rework-rate.test.cjs} | 0 ...ills-export-import.test.js => skills-export-import.test.cjs} | 0 test/{version-stamping.test.js => version-stamping.test.cjs} | 0 test/{workflows.test.js => workflows.test.cjs} | 0 28 files changed, 19 insertions(+), 19 deletions(-) rename test/{email-scrub.test.js => email-scrub.test.cjs} (100%) rename test/{init-flow.test.js => init-flow.test.cjs} (100%) rename test/{mcp-config.test.js => mcp-config.test.cjs} (100%) rename test/{migrate-directory.test.js => migrate-directory.test.cjs} (100%) rename test/{plugin-marketplace.test.js => plugin-marketplace.test.cjs} (100%) rename test/{rework-rate.test.js => rework-rate.test.cjs} (100%) rename test/{skills-export-import.test.js => skills-export-import.test.cjs} (100%) rename test/{version-stamping.test.js => version-stamping.test.cjs} (100%) rename test/{workflows.test.js => workflows.test.cjs} (100%) diff --git a/.github/workflows/squad-insider-release.yml b/.github/workflows/squad-insider-release.yml index 1ea4f6500..36a1121bf 100644 --- a/.github/workflows/squad-insider-release.yml +++ b/.github/workflows/squad-insider-release.yml @@ -20,7 +20,7 @@ jobs: node-version: 22 - name: Run tests - run: node --test test/*.test.js + run: node --test test/*.test.cjs - name: Read version from package.json id: version diff --git a/.github/workflows/squad-preview.yml b/.github/workflows/squad-preview.yml index 9298c364e..9df39e079 100644 --- a/.github/workflows/squad-preview.yml +++ b/.github/workflows/squad-preview.yml @@ -27,7 +27,7 @@ jobs: echo "✅ Version $VERSION validated in CHANGELOG.md" - name: Run tests - run: node --test test/*.test.js + run: node --test test/*.test.cjs - name: Check no .ai-team/ or .squad/ files are tracked run: | diff --git a/.github/workflows/squad-release.yml b/.github/workflows/squad-release.yml index bbd5de793..6ae0f07fd 100644 --- a/.github/workflows/squad-release.yml +++ b/.github/workflows/squad-release.yml @@ -20,7 +20,7 @@ jobs: node-version: 22 - name: Run tests - run: node --test test/*.test.js + run: node --test test/*.test.cjs - name: Validate version consistency run: | diff --git a/.squad-templates/workflows/squad-ci.yml b/.squad-templates/workflows/squad-ci.yml index 2f809d70f..493dafc7c 100644 --- a/.squad-templates/workflows/squad-ci.yml +++ b/.squad-templates/workflows/squad-ci.yml @@ -21,4 +21,4 @@ jobs: node-version: 22 - name: Run tests - run: node --test test/*.test.js + run: node --test test/*.test.cjs diff --git a/.squad-templates/workflows/squad-insider-release.yml b/.squad-templates/workflows/squad-insider-release.yml index 1ea4f6500..36a1121bf 100644 --- a/.squad-templates/workflows/squad-insider-release.yml +++ b/.squad-templates/workflows/squad-insider-release.yml @@ -20,7 +20,7 @@ jobs: node-version: 22 - name: Run tests - run: node --test test/*.test.js + run: node --test test/*.test.cjs - name: Read version from package.json id: version diff --git a/.squad-templates/workflows/squad-preview.yml b/.squad-templates/workflows/squad-preview.yml index 9298c364e..9df39e079 100644 --- a/.squad-templates/workflows/squad-preview.yml +++ b/.squad-templates/workflows/squad-preview.yml @@ -27,7 +27,7 @@ jobs: echo "✅ Version $VERSION validated in CHANGELOG.md" - name: Run tests - run: node --test test/*.test.js + run: node --test test/*.test.cjs - name: Check no .ai-team/ or .squad/ files are tracked run: | diff --git a/.squad-templates/workflows/squad-release.yml b/.squad-templates/workflows/squad-release.yml index bbd5de793..6ae0f07fd 100644 --- a/.squad-templates/workflows/squad-release.yml +++ b/.squad-templates/workflows/squad-release.yml @@ -20,7 +20,7 @@ jobs: node-version: 22 - name: Run tests - run: node --test test/*.test.js + run: node --test test/*.test.cjs - name: Validate version consistency run: | diff --git a/packages/squad-cli/templates/workflows/squad-ci.yml b/packages/squad-cli/templates/workflows/squad-ci.yml index 2f809d70f..493dafc7c 100644 --- a/packages/squad-cli/templates/workflows/squad-ci.yml +++ b/packages/squad-cli/templates/workflows/squad-ci.yml @@ -21,4 +21,4 @@ jobs: node-version: 22 - name: Run tests - run: node --test test/*.test.js + run: node --test test/*.test.cjs diff --git a/packages/squad-cli/templates/workflows/squad-insider-release.yml b/packages/squad-cli/templates/workflows/squad-insider-release.yml index 1ea4f6500..36a1121bf 100644 --- a/packages/squad-cli/templates/workflows/squad-insider-release.yml +++ b/packages/squad-cli/templates/workflows/squad-insider-release.yml @@ -20,7 +20,7 @@ jobs: node-version: 22 - name: Run tests - run: node --test test/*.test.js + run: node --test test/*.test.cjs - name: Read version from package.json id: version diff --git a/packages/squad-cli/templates/workflows/squad-preview.yml b/packages/squad-cli/templates/workflows/squad-preview.yml index 9298c364e..9df39e079 100644 --- a/packages/squad-cli/templates/workflows/squad-preview.yml +++ b/packages/squad-cli/templates/workflows/squad-preview.yml @@ -27,7 +27,7 @@ jobs: echo "✅ Version $VERSION validated in CHANGELOG.md" - name: Run tests - run: node --test test/*.test.js + run: node --test test/*.test.cjs - name: Check no .ai-team/ or .squad/ files are tracked run: | diff --git a/packages/squad-cli/templates/workflows/squad-release.yml b/packages/squad-cli/templates/workflows/squad-release.yml index bbd5de793..6ae0f07fd 100644 --- a/packages/squad-cli/templates/workflows/squad-release.yml +++ b/packages/squad-cli/templates/workflows/squad-release.yml @@ -20,7 +20,7 @@ jobs: node-version: 22 - name: Run tests - run: node --test test/*.test.js + run: node --test test/*.test.cjs - name: Validate version consistency run: | diff --git a/packages/squad-sdk/templates/workflows/squad-ci.yml b/packages/squad-sdk/templates/workflows/squad-ci.yml index 2f809d70f..493dafc7c 100644 --- a/packages/squad-sdk/templates/workflows/squad-ci.yml +++ b/packages/squad-sdk/templates/workflows/squad-ci.yml @@ -21,4 +21,4 @@ jobs: node-version: 22 - name: Run tests - run: node --test test/*.test.js + run: node --test test/*.test.cjs diff --git a/packages/squad-sdk/templates/workflows/squad-insider-release.yml b/packages/squad-sdk/templates/workflows/squad-insider-release.yml index 1ea4f6500..36a1121bf 100644 --- a/packages/squad-sdk/templates/workflows/squad-insider-release.yml +++ b/packages/squad-sdk/templates/workflows/squad-insider-release.yml @@ -20,7 +20,7 @@ jobs: node-version: 22 - name: Run tests - run: node --test test/*.test.js + run: node --test test/*.test.cjs - name: Read version from package.json id: version diff --git a/packages/squad-sdk/templates/workflows/squad-preview.yml b/packages/squad-sdk/templates/workflows/squad-preview.yml index 9298c364e..9df39e079 100644 --- a/packages/squad-sdk/templates/workflows/squad-preview.yml +++ b/packages/squad-sdk/templates/workflows/squad-preview.yml @@ -27,7 +27,7 @@ jobs: echo "✅ Version $VERSION validated in CHANGELOG.md" - name: Run tests - run: node --test test/*.test.js + run: node --test test/*.test.cjs - name: Check no .ai-team/ or .squad/ files are tracked run: | diff --git a/packages/squad-sdk/templates/workflows/squad-release.yml b/packages/squad-sdk/templates/workflows/squad-release.yml index bbd5de793..6ae0f07fd 100644 --- a/packages/squad-sdk/templates/workflows/squad-release.yml +++ b/packages/squad-sdk/templates/workflows/squad-release.yml @@ -20,7 +20,7 @@ jobs: node-version: 22 - name: Run tests - run: node --test test/*.test.js + run: node --test test/*.test.cjs - name: Validate version consistency run: | diff --git a/templates/workflows/squad-ci.yml b/templates/workflows/squad-ci.yml index 2f809d70f..493dafc7c 100644 --- a/templates/workflows/squad-ci.yml +++ b/templates/workflows/squad-ci.yml @@ -21,4 +21,4 @@ jobs: node-version: 22 - name: Run tests - run: node --test test/*.test.js + run: node --test test/*.test.cjs diff --git a/templates/workflows/squad-insider-release.yml b/templates/workflows/squad-insider-release.yml index 1ea4f6500..36a1121bf 100644 --- a/templates/workflows/squad-insider-release.yml +++ b/templates/workflows/squad-insider-release.yml @@ -20,7 +20,7 @@ jobs: node-version: 22 - name: Run tests - run: node --test test/*.test.js + run: node --test test/*.test.cjs - name: Read version from package.json id: version diff --git a/templates/workflows/squad-preview.yml b/templates/workflows/squad-preview.yml index 9298c364e..9df39e079 100644 --- a/templates/workflows/squad-preview.yml +++ b/templates/workflows/squad-preview.yml @@ -27,7 +27,7 @@ jobs: echo "✅ Version $VERSION validated in CHANGELOG.md" - name: Run tests - run: node --test test/*.test.js + run: node --test test/*.test.cjs - name: Check no .ai-team/ or .squad/ files are tracked run: | diff --git a/templates/workflows/squad-release.yml b/templates/workflows/squad-release.yml index bbd5de793..6ae0f07fd 100644 --- a/templates/workflows/squad-release.yml +++ b/templates/workflows/squad-release.yml @@ -20,7 +20,7 @@ jobs: node-version: 22 - name: Run tests - run: node --test test/*.test.js + run: node --test test/*.test.cjs - name: Validate version consistency run: | diff --git a/test/email-scrub.test.js b/test/email-scrub.test.cjs similarity index 100% rename from test/email-scrub.test.js rename to test/email-scrub.test.cjs diff --git a/test/init-flow.test.js b/test/init-flow.test.cjs similarity index 100% rename from test/init-flow.test.js rename to test/init-flow.test.cjs diff --git a/test/mcp-config.test.js b/test/mcp-config.test.cjs similarity index 100% rename from test/mcp-config.test.js rename to test/mcp-config.test.cjs diff --git a/test/migrate-directory.test.js b/test/migrate-directory.test.cjs similarity index 100% rename from test/migrate-directory.test.js rename to test/migrate-directory.test.cjs diff --git a/test/plugin-marketplace.test.js b/test/plugin-marketplace.test.cjs similarity index 100% rename from test/plugin-marketplace.test.js rename to test/plugin-marketplace.test.cjs diff --git a/test/rework-rate.test.js b/test/rework-rate.test.cjs similarity index 100% rename from test/rework-rate.test.js rename to test/rework-rate.test.cjs diff --git a/test/skills-export-import.test.js b/test/skills-export-import.test.cjs similarity index 100% rename from test/skills-export-import.test.js rename to test/skills-export-import.test.cjs diff --git a/test/version-stamping.test.js b/test/version-stamping.test.cjs similarity index 100% rename from test/version-stamping.test.js rename to test/version-stamping.test.cjs diff --git a/test/workflows.test.js b/test/workflows.test.cjs similarity index 100% rename from test/workflows.test.js rename to test/workflows.test.cjs