Skip to content

build(check-and-move-issue-based-on-labels-v1): migrate to ESM + node:test#394

Merged
Garbee merged 4 commits into
mainfrom
chore/migrate-check-and-move-issue-based-on-labels-v1
Jun 22, 2026
Merged

build(check-and-move-issue-based-on-labels-v1): migrate to ESM + node:test#394
Garbee merged 4 commits into
mainfrom
chore/migrate-check-and-move-issue-based-on-labels-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 (check-and-move-issue-based-on-labels-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 (getIssueLabels.test.ts, 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 check-and-move-issue-based-on-labels-v1 — green
  • npm run lint -w check-and-move-issue-based-on-labels-v1 — green
  • npm run test -w check-and-move-issue-based-on-labels-v1 — green (single command runs node:test with coverage; 100% lines / 85% branches / 100% functions enforced from node.config.json)
  • npm run build -w check-and-move-issue-based-on-labels-v1 — green (esbuild ESM dist/index.js + regenerated dist/licenses.txt)

Closes: #375

@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 check-and-move-issue-based-on-labels-v1 GitHub Action workspace from the Mocha/nyc/ts-node/ncc toolchain to an ESM + node:test + tsx + esbuild-based setup, aligning with the per-workspace migration approach described in #361/#360.

Changes:

  • Switch workspace to ESM ("type": "module") and update scripts to use shared build-action.mjs plus a single node --test + coverage test command.
  • Add per-workspace node.config.json for tsx loading, reporter config, and coverage thresholds.
  • Rewrite tests to node:test and Node’s built-in mocking (mock.module, mock.fn); regenerate dist/ and drop committed .d.ts artifacts.

Reviewed changes

Copilot reviewed 5 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
.github/actions/check-and-move-issue-based-on-labels-v1/package.json Switch to ESM; replace build/test tooling; add typecheck; remove nyc config.
.github/actions/check-and-move-issue-based-on-labels-v1/node.config.json Configure tsx loader, test reporter, and coverage include/exclude + thresholds.
.github/actions/check-and-move-issue-based-on-labels-v1/tsconfig.json Add interim ESM/bundler resolution overrides and exclude dist/.
.github/actions/check-and-move-issue-based-on-labels-v1/src/run.test.ts Port tests to node:test + mock.module/mock.fn.
.github/actions/check-and-move-issue-based-on-labels-v1/src/getIssueLabels.test.ts Port tests to node:test + mock.fn.
.github/actions/check-and-move-issue-based-on-labels-v1/dist/licenses.txt Refresh generated license bundle output.
.github/actions/check-and-move-issue-based-on-labels-v1/dist/check-and-move-issue-based-on-labels-v1/src/types.d.ts Remove previously committed generated .d.ts artifact.
.github/actions/check-and-move-issue-based-on-labels-v1/dist/check-and-move-issue-based-on-labels-v1/src/run.d.ts Remove previously committed generated .d.ts artifact.
.github/actions/check-and-move-issue-based-on-labels-v1/dist/check-and-move-issue-based-on-labels-v1/src/index.d.ts Remove previously committed generated .d.ts artifact.
.github/actions/check-and-move-issue-based-on-labels-v1/dist/check-and-move-issue-based-on-labels-v1/src/getIssueLabels.d.ts Remove previously committed generated .d.ts artifact.
.github/actions/check-and-move-issue-based-on-labels-v1/dist/add-to-board-v1/src/moveIssueToColumn.d.ts Remove previously committed generated .d.ts artifact.
.github/actions/check-and-move-issue-based-on-labels-v1/dist/add-to-board-v1/src/getProjectBoardID.d.ts Remove previously committed generated .d.ts artifact.
.github/actions/check-and-move-issue-based-on-labels-v1/dist/add-to-board-v1/src/getProjectBoardFieldList.d.ts Remove previously committed generated .d.ts artifact.

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

Comment thread .github/actions/check-and-move-issue-based-on-labels-v1/src/run.test.ts Outdated
Comment thread .github/actions/check-and-move-issue-based-on-labels-v1/src/run.test.ts Outdated
Comment thread .github/actions/check-and-move-issue-based-on-labels-v1/src/run.test.ts Outdated
Comment thread .github/actions/check-and-move-issue-based-on-labels-v1/src/run.test.ts Outdated
…pinned toolchain

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 5 out of 14 changed files in this pull request and generated 3 comments.

Comment thread .github/actions/check-and-move-issue-based-on-labels-v1/src/run.test.ts Outdated
Comment thread .github/actions/check-and-move-issue-based-on-labels-v1/src/run.test.ts Outdated
- Import Core/GitHub as type-only (they have no runtime bindings).
- Align the mock.module specifiers with the extensionless paths run.ts
  imports, so the mocks reliably intercept the same module.
- Fix a test description that referenced label-prefixes-to-match twice; it
  should be the match vs exclude 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
…:test (#399)

## 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`).

> **Stacked on #394** (`check-and-move-issue-based-on-labels-v1`). This
action imports the real `getIssueLabels` from that sibling and exercises
it (no module mock), so it needs the sibling's ESM conversion present to
be green. Base is
`chore/migrate-check-and-move-issue-based-on-labels-v1`; the diff here
is **only** this workspace. **Retarget to `main` after #394 merges.**

## 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-issue-based-on-existing-labels-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-issue-based-on-existing-labels-v1` — green
- `npm run lint -w label-issue-based-on-existing-labels-v1` — green
- `npm run test -w label-issue-based-on-existing-labels-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-issue-based-on-existing-labels-v1` — green
(esbuild ESM `dist/index.js` + regenerated `dist/licenses.txt`)

Closes: #379

@chutchins25 chutchins25 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good to me.

@Garbee Garbee merged commit 57b5427 into main Jun 22, 2026
18 checks passed
@Garbee Garbee deleted the chore/migrate-check-and-move-issue-based-on-labels-v1 branch June 22, 2026 15:28
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 check-and-move-issue-based-on-labels-v1 to ESM + node:test

3 participants