Skip to content

fix(build): keep tests/*.mjs out of tsc input; cover *.mjs in lint/format - #2472

Open
RibatTRW wants to merge 1 commit into
lnreader:masterfrom
RibatTRW:spec/tsconfig-tests-exclude
Open

fix(build): keep tests/*.mjs out of tsc input; cover *.mjs in lint/format#2472
RibatTRW wants to merge 1 commit into
lnreader:masterfrom
RibatTRW:spec/tsconfig-tests-exclude

Conversation

@RibatTRW

Copy link
Copy Markdown

What

With a plain-node regression script present under tests/, building with

npx tsc --project tsconfig.production.json && node scripts/build-plugin-manifest.js

produces an EMPTY plugin manifest: .dist/plugins.json reports | Total | 0 (0) |, so any downstream "plugin X absent" assertion passes vacuously.

Why / how

  • tsconfig.production.json sets allowJs: true, defines no rootDir, and its exclude array lists neither tests/** nor any .mjs pattern.
  • A tests/regression-*.mjs file therefore enters the tsc program; the inferred rootDir becomes the repo root; emit lands nested at .js/plugins/plugins/<lang>/<file>.js plus .js/plugins/tests/regression-N.mjs.
  • scripts/build-plugin-manifest.js scans ./.js/plugins/<lang>/, finds nothing, and writes [].

Fix (4 files, +6/-4):

  1. tsconfig.json and tsconfig.production.json: insert "./tests/**" into exclude, right after the existing "scripts/**" entry (same convention: tooling that plain node runs, tsc ignores).
  2. eslint.config.js: extend the project-rules files glob from {ts,tsx,mts,cts,js,cjs} to {ts,tsx,mts,cts,js,cjs,mjs,mjsx}; that config object already registers node globals, which the .mjs scripts need.
  3. package.json: add mjs to the format / format:check globs and to lint-staged.

No rootDir change, no emit-layout reshaping, no manifest-script edit.

Tests

Executed locally on 2026-08-25 at base e1dcd06 (RED baseline) and at this branch head (GREEN); tsc 5.9.3, node v26.5.1.

Gate Base (no fix) This branch
tsc -p tsconfig.production.json exit 0 but nested emit: .js/plugins/plugins/{arabic..vietnamese} and .js/plugins/tests/regression-2453.mjs; manifest | Total | 0 (0) | (RED) exit 0; no .js/plugins/plugins, no .js/tests; manifest | Total | 117 (68) |
Placement equivalence: tests/ moved out of tree, fresh rebuild n/a identical | Total | 117 (68) | (tsc input scope no longer depends on test placement)
eslint on tests/**/*.mjs + eslint.config.js 3 false no-undef errors on regression-2453.mjs (console x2, process) exit 0
prettier --check on package.json, eslint.config.js, tsconfig.production.json, tests/*.mjs - all clean (tsconfig.json keeps pre-existing upstream style debt, deliberately untouched)
regression harness run byte-identical stdout and exit code before vs after (its own PASS/FAIL verdict belongs to #2453/#2468)

Context for the totals (2026-08-25): #2468 (RanobeHub retirement) is OPEN, so 117 (68) is correct against current master; once it merges, the expected total becomes 116 (67). #2466 (Riwyat) is OPEN too; if it lands first, its eslint config object and this glob extension are separate hunks that compose cleanly.

Gates

  • Branch diff vs e1dcd06: exactly 4 files changed, +6/-4, nothing else; no lockfile churn; no CI workflow edits.
  • .github/workflows/publish-plugins.yml untouched.

Closes: none (repo-level build defect, no upstream issue).

Automated contribution via Hermes Agent.

…rmat

- tsconfig.json, tsconfig.production.json: exclude ./tests/** (allowJs
  with no rootDir made the inferred rootDir the repo root once tests/
  existed, emitting nested .js/plugins/plugins/<lang>/ and an empty
  manifest, Total 0 (0))
- eslint.config.js: add mjs,mjsx to the project-rules files glob
- package.json: format/format:check and lint-staged globs cover mjs

Verified at e1dcd06: manifest builds Total 117 (68) with tests
in-tree AND out-of-tree; eslint on tests/regression-2453.mjs clean;
prettier clean on all touched files except pre-existing tsconfig.json
style debt (left untouched).
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.

1 participant