Skip to content

build(label-released-issues-v1): migrate to ESM + node:test#397

Open
Garbee wants to merge 3 commits into
mainfrom
chore/migrate-label-released-issues-v1
Open

build(label-released-issues-v1): migrate to ESM + node:test#397
Garbee wants to merge 3 commits into
mainfrom
chore/migrate-label-released-issues-v1

Conversation

@Garbee

@Garbee Garbee commented Jun 16, 2026

Copy link
Copy Markdown
Member

Problem

Part of #361 — converting each buildable action workspace off the old toolchain (ts-node + mocha + nyc + chai/sinon + ncc) onto node:test + tsx + esbuild, so dependencies can be updated without the TS6/ts-node breakage. Follows the exemplar #360 (get-release-issue-v1).

Approach

Migrate this one workspace, fully self-contained and green on its own. Coverage is no longer a separate step — the single test script always runs Node's built-in coverage and enforces the thresholds from node.config.json. The root toolchain stays CommonJS; this workspace gets an interim tsconfig override that is removed in the final flip PR.

Changes (label-released-issues-v1)

  • package.json"type": "module"; a single test script running node --experimental-default-config-file --experimental-test-module-mocks --experimental-test-coverage --test --test-force-exit 'src/**/*.test.ts'; build via the shared node ../../../scripts/build-action.mjs; typecheck: tsc --noEmit; removed the nyc block (thresholds moved to node.config.json).
  • node.config.json (new) — --experimental-default-config-file source: import: ["tsx"], test-reporter: ["spec"], coverage include src/**/*.ts (excluding src/**/*.test.ts, src/index.ts), with the original 100 / 85 / 100 line / branch / function thresholds.
  • tsconfig.json — interim ESM override (module: esnext, moduleResolution: bundler, allowImportingTsExtensions, noEmit) so this workspace is ESM while the repo root is still CommonJS. Removed in the final flip PR.
  • Tests (run.test.ts) — rewritten to node:test / node:assert / mock.module (replaces mocha/chai/sinon).
  • dist/ — regenerated as an ESM esbuild bundle; the ncc .d.ts artifacts are dropped and dist/licenses.txt is refreshed. (dist/** is linguist-generated, so it collapses in the diff.)
  • CI — this workspace has no dedicated job in .github/workflows/tests.yml; that file is unchanged.

Verification

Locally (node 24), this workspace only:

  • npm run typecheck -w label-released-issues-v1 — green
  • npm run lint -w label-released-issues-v1 — green
  • npm run test -w label-released-issues-v1 — green (single command runs node:test with coverage; 100% lines / 85% branches / 100% functions enforced from node.config.json)
  • npm run build -w label-released-issues-v1 — green (esbuild ESM dist/index.js + regenerated dist/licenses.txt)

Closes: #380

@Garbee Garbee self-assigned this Jun 16, 2026
@Garbee Garbee requested a review from Copilot June 16, 2026 16:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Migrates the label-released-issues-v1 GitHub Action workspace to an ESM-based toolchain using node:test + tsx + esbuild, aligning it with the per-workspace migration pattern established in #360.

Changes:

  • Convert the workspace to ESM ("type": "module") and switch tests from mocha/chai/sinon to node:test with built-in coverage driven by node.config.json.
  • Add an interim ESM-oriented tsconfig.json override for this workspace (module/moduleResolution/noEmit/excludes).
  • Regenerate dist/ using esbuild (dropping prior ncc-generated .d.ts artifacts) and refresh third-party license output.

Reviewed changes

Copilot reviewed 4 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
.github/actions/label-released-issues-v1/package.json Switches workspace to ESM and updates build/test/typecheck/lint scripts to the new toolchain.
.github/actions/label-released-issues-v1/node.config.json Adds Node default config for tsx import, reporter, and coverage include/exclude + thresholds.
.github/actions/label-released-issues-v1/tsconfig.json Adds workspace-local ESM/bundler TS settings (interim override) and excludes dist/.
.github/actions/label-released-issues-v1/src/run.test.ts Rewrites tests to node:test + node:assert and replaces sinon-style stubbing with node:test mocks/module mocks.
.github/actions/label-released-issues-v1/dist/index.js Regenerated bundled ESM artifact for GitHub Actions runtime.
.github/actions/label-released-issues-v1/dist/licenses.txt Refreshed bundled third-party license summary output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/actions/label-released-issues-v1/src/run.test.ts Outdated
Comment thread .github/actions/label-released-issues-v1/dist/index.js Outdated
The committed bundle was built with a stale/non-pinned esbuild and baked
machine-absolute paths into module-annotation comments. Rebuilding with the
repo's pinned esbuild emits repo-relative paths; the bundle is now
byte-deterministic across builds.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 4 out of 12 changed files in this pull request and generated 2 comments.

Comment thread .github/actions/label-released-issues-v1/src/run.test.ts Outdated
Comment thread .github/actions/label-released-issues-v1/src/run.test.ts Outdated
- Use extensionless local type imports, matching the production code's
  specifiers (avoids duplicate module identities).
- Drop the .ts extension from the mock.module specifiers so they match the
  extensionless paths run.ts imports.
- The non-numeric project-number test now uses generateInputs to supply
  valid defaults and override only project-number, rather than returning ''
  for the other required inputs.
@Garbee Garbee marked this pull request as ready for review June 17, 2026 17:17
@Garbee Garbee requested review from a team as code owners June 17, 2026 17:17
@Garbee Garbee enabled auto-merge (squash) June 17, 2026 17:20
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.

Convert label-released-issues-v1 to ESM + node:test

2 participants