Skip to content

fix(ci): rename node:test files to .cjs for ESM compatibility#671

Merged
bradygaster merged 2 commits intobradygaster:devfrom
tamirdresher:fix/esm-test-files
Mar 29, 2026
Merged

fix(ci): rename node:test files to .cjs for ESM compatibility#671
bradygaster merged 2 commits intobradygaster:devfrom
tamirdresher:fix/esm-test-files

Conversation

@tamirdresher
Copy link
Copy Markdown
Collaborator

Problem

Squad Release, Squad Preview, and Squad Insider Release workflows have been failing on every push to main since the ESM migration. All 9 node:test files fail with:

ReferenceError: require is not defined in ES module scope

Root cause: package.json has "type": "module" but the 9 node:test files use require() (CommonJS). Node.js treats .js files as ESM in module-type packages.

Fix

Rename .test.js to .test.cjs (explicit CommonJS marker) and update all workflow globs from test/.test.js to test/.test.cjs.

Zero logic changes -- only file extensions and glob patterns.

Files changed

  • 9 test files renamed: .test.js to .test.cjs
  • 19 workflow files updated: glob pattern in active workflows + all template copies (CLI, SDK, squad-templates, root templates)

Not affected

  • Vitest: config only includes test/**/*.test.ts, ignores .cjs files
  • Test logic: no code changes, just file extensions

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>
Copilot AI review requested due to automatic review settings March 28, 2026 15:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes CI failures after the repo’s ESM migration by ensuring the Node.js built-in test runner executes CommonJS test files correctly in a "type": "module" package.

Changes:

  • Renames the Node node:test suite from *.test.js to *.test.cjs to force CommonJS execution.
  • Updates all release/preview/insider/CI workflow templates (and their mirrored copies) to run node --test test/*.test.cjs.

Reviewed changes

Copilot reviewed 19 out of 28 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/workflows.test.cjs CommonJS node:test suite file renamed to .cjs for ESM-package compatibility.
test/version-stamping.test.cjs CommonJS node:test suite file renamed to .cjs for ESM-package compatibility.
test/skills-export-import.test.cjs CommonJS node:test suite file renamed to .cjs for ESM-package compatibility.
test/rework-rate.test.cjs CommonJS node:test suite file renamed to .cjs for ESM-package compatibility.
test/plugin-marketplace.test.cjs CommonJS node:test suite file renamed to .cjs for ESM-package compatibility.
test/migrate-directory.test.cjs CommonJS node:test suite file renamed to .cjs for ESM-package compatibility.
test/mcp-config.test.cjs CommonJS node:test suite file renamed to .cjs for ESM-package compatibility.
test/init-flow.test.cjs CommonJS node:test suite file renamed to .cjs for ESM-package compatibility.
test/email-scrub.test.cjs CommonJS node:test suite file renamed to .cjs for ESM-package compatibility.
templates/workflows/squad-ci.yml Updates workflow test glob to run .test.cjs files.
templates/workflows/squad-preview.yml Updates workflow test glob to run .test.cjs files.
templates/workflows/squad-release.yml Updates workflow test glob to run .test.cjs files.
templates/workflows/squad-insider-release.yml Updates workflow test glob to run .test.cjs files.
packages/squad-cli/templates/workflows/squad-ci.yml Keeps template mirrors in sync by updating test glob to .test.cjs.
packages/squad-cli/templates/workflows/squad-preview.yml Keeps template mirrors in sync by updating test glob to .test.cjs.
packages/squad-cli/templates/workflows/squad-release.yml Keeps template mirrors in sync by updating test glob to .test.cjs.
packages/squad-cli/templates/workflows/squad-insider-release.yml Keeps template mirrors in sync by updating test glob to .test.cjs.
packages/squad-sdk/templates/workflows/squad-ci.yml Keeps template mirrors in sync by updating test glob to .test.cjs.
packages/squad-sdk/templates/workflows/squad-preview.yml Keeps template mirrors in sync by updating test glob to .test.cjs.
packages/squad-sdk/templates/workflows/squad-release.yml Keeps template mirrors in sync by updating test glob to .test.cjs.
packages/squad-sdk/templates/workflows/squad-insider-release.yml Keeps template mirrors in sync by updating test glob to .test.cjs.
.squad-templates/workflows/squad-ci.yml Updates canonical template set to use .test.cjs glob.
.squad-templates/workflows/squad-preview.yml Updates canonical template set to use .test.cjs glob.
.squad-templates/workflows/squad-release.yml Updates canonical template set to use .test.cjs glob.
.squad-templates/workflows/squad-insider-release.yml Updates canonical template set to use .test.cjs glob.
.github/workflows/squad-preview.yml Fixes failing preview workflow by running .test.cjs Node tests.
.github/workflows/squad-release.yml Fixes failing release workflow by running .test.cjs Node tests.
.github/workflows/squad-insider-release.yml Fixes failing insider workflow by running .test.cjs Node tests.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 28 changed files in this pull request and generated no new comments.

@bradygaster bradygaster merged commit a1565bb into bradygaster:dev Mar 29, 2026
7 checks passed
robzelt pushed a commit to robzelt/squad that referenced this pull request Apr 1, 2026
…gaster#666, bradygaster#676) (bradygaster#682)

* docs(ai-team): CLI UI Polish PRD finalized — 20 issues created

Session: 2026-03-01T20-13-00Z-ui-polish-prd
Requested by: Brady

Changes:
- Created 6 orchestration logs (.squad/orchestration-log/2026-03-01T20-24-57Z-*.md)
- Created session log (.squad/log/2026-03-01T20-13-00Z-ui-polish-prd.md)
- Merged 5 decision files into decisions.md (PRD strategy, cast confirmation, processing state, Brady directives)
- Deleted inbox files after merge (deduplication complete)
- Updated team history files (Cheritto, Kovash, Redfoot, Marquez, Keaton, Fenster)
- PRD created (docs/prd-cli-ui-polish.md) with 20 discrete issues (bradygaster#662-681) for alpha-1 release
- Pragmatic alpha-first strategy: P0 blockers (blank screens, spinner, banner) + P1 quick wins, defer grand redesign

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(tui): consolidate separators, fix empty space, add info hierarchy and breathing room (bradygaster#655, bradygaster#670, bradygaster#671, bradygaster#677)

- Create shared Separator component in components/Separator.tsx (bradygaster#677)
  All inline separator rendering (box.h.repeat) replaced across
  App.tsx, AgentPanel.tsx, and MessageStream.tsx

- Remove flexGrow={1} from MessageStream outer Box (bradygaster#655)
  This was pushing content to bottom of viewport with empty space above

- Bold primary CTAs in dim contexts (bradygaster#670)
  Header: @agent and /help now bold within dimColor usage line
  First-run: 'Try:' prompt bolded
  AgentPanel empty state: 'Send a message' and '/help' bolded

- Add whitespace breathing room (bradygaster#671)
  Header wrapper gets marginBottom={1}
  Turn separators get marginTop={1}
  AgentPanel bottom separators upgraded from marginTop={0} to marginTop={1}

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs: update Cheritto history and add separator decision

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: wire onPermissionRequest handler in CLI session creation (bradygaster#651)

Add approveAllPermissions handler to all 4 client.createSession() calls
in the CLI shell. The handler was defined in SDK adapter types but never
wired, causing a raw SDK error for users.

- Add approve-all handler in shell/index.ts (CLI runs locally with user trust)
- Export SquadPermissionHandler types from @bradygaster/squad-sdk/client
- Add clear error guidance in adapter/client.ts for missing handler

Closes bradygaster#651

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(tui): bump secondary text contrast and wire table wrapping (bradygaster#666, bradygaster#676)

- Replace dimColor with color="gray" for secondary text (system messages,
  italic markdown, duration labels, agent activity feed) — higher contrast
  than dim on dark terminals
- Add GRAY ANSI constant and secondary() helper to output.ts
- Add wrapTableContent() + truncateTableColumns() to MessageStream — tables
  exceeding terminal width are column-truncated with ellipsis
- Wire table wrapping into both message history and streaming content paths

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants