fix(ci): trigger on scripts/, and actually run its 71 orphaned tests (#1263) - #1269
Conversation
WalkthroughAdds Node-based coverage for plugin generation and enterprise setup scripts, exposes it through ChangesScript CI coverage
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…1263) Two gaps, and the second was the real one. CI's path filter did not include scripts/, so a change confined to it skipped CI entirely. scripts/ holds the plugin and connector import generators that run as predev/prebuild — a break there stops every dev and build. More seriously: scripts/__tests__ was run by NO workflow at all. 71 tests, including coverage of those generators, had never gated a PR. They could not be run with one command either, because the directory mixes two runners: three files use vitest, two use node's built-in node:test. A single 'vitest run scripts/__tests__' fails on the latter with 'No test suite found'. Rather than rewrite 59 assertions across two currently-PASSING files — 11 of them multi-line, so a regex conversion would risk quiet damage — the two runners' file sets are now self-maintaining by naming: *.test.mjs for vitest, *.node-test.mjs for node --test. Adding a file to either set needs no script change. Standardising on one runner is worth doing, but not as a drive-by rewrite of green tests. Also excludes .claude/worktrees from vitest discovery: stale agent worktrees on disk were being picked up as duplicate test files. Correction to this issue's premise: I claimed 'eslint . covers scripts/'. It does not. eslint.config.js has a config block only for **/*.{ts,tsx}, so root JS matches no block and is silently unlinted. Adding coverage surfaces 33 problems across 8 files — a separate change, filed rather than smuggled in here. Adding scripts/** to the paths still matters: it is what makes the new test:scripts step run. verify now includes test:scripts: 248 + 115 + 28 + 3 vitest files, plus 36 node:test assertions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
0eb52ff to
7db1624
Compare
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
scripts/__tests__/setup-enterprise.node-test.mjs (1)
11-16: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winConsider adding a
timeouttospawnSynccalls.None of the
run()invocations specify a timeout, so a future regression that makes the script block (e.g. an interactive prompt) would hang the test until the CI job's overall timeout instead of failing fast with a clear error.♻️ Suggested tweak
function run(args = [], env = {}) { return spawnSync("bash", [SCRIPT, ...args], { encoding: "utf8", env: { ...process.env, ...env }, + timeout: 10_000, }); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/__tests__/setup-enterprise.node-test.mjs` around lines 11 - 16, Add a finite timeout option to the spawnSync configuration inside run, using the existing call path for all invocations so blocked scripts fail promptly rather than hanging CI.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@scripts/__tests__/setup-enterprise.node-test.mjs`:
- Around line 11-16: Add a finite timeout option to the spawnSync configuration
inside run, using the existing call path for all invocations so blocked scripts
fail promptly rather than hanging CI.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 0368a98a-0c6e-4878-834f-08d208ceecbd
📒 Files selected for processing (4)
.github/workflows/ci.ymlpackage.jsonscripts/__tests__/generate-plugin-imports.node-test.mjsscripts/__tests__/setup-enterprise.node-test.mjs



Closes #1263 — and corrects its premise.
Two gaps; the second was the real one
CI's path filter omitted
scripts/, so a change confined to it skipped CI entirely. That directory holds the plugin and connector import generators that run aspredev/prebuild— a break there stops every dev and every build.More seriously:
scripts/__tests__was run by no workflow at all. 71 tests, including coverage of those generators, had never gated a PR.Why one command didn't already exist
The directory mixes two runners — three files use vitest, two use Node's built-in
node:test. A singlevitest run scripts/__tests__fails on the latter withNo test suite found in file.I chose not to convert them. Those two files currently pass (36 assertions), and converting 59
assert.*calls — 11 of them multi-line — via regex risks quiet damage to green tests for no functional gain. Instead the two runners' file sets are now self-maintaining by naming:*.test.mjs→ vitest*.node-test.mjs→node --testAdding a file to either set needs no script change. Standardising on one runner is worth doing, but not as a drive-by rewrite.
Correction to my own issue
I wrote that
eslint .coversscripts/. It does not.eslint.config.jshas a config block only for**/*.{ts,tsx}, so root-level JS matches no block and is silently unlinted — enabling it surfaces 33 problems across 8 files. That is a separate change, filed rather than smuggled in here.Adding
scripts/**to the paths still matters, because it's what makes the newtest:scriptsstep run.Also fixed
Vitest was discovering stale agent worktrees under
.claude/worktrees/as duplicate test files; now excluded.Verification
npm run test:scripts— 3 vitest files / 35 tests, plus 36node:testassertionsnpm run verifynow includes it: 248 + 115 + 28 + 3 vitest files, all greenscripts/error and it did not — which is exactly how the eslint-coverage gap above was discovered🤖 Generated with Claude Code
Summary by CodeRabbit
Tests
Chores