Skip to content

fix(ci): run packages/eslint-plugin/ tests as part of root npm test (#1766)#1767

Merged
bokelley merged 2 commits into
mainfrom
fix/ci-workspace-eslint-plugin
May 15, 2026
Merged

fix(ci): run packages/eslint-plugin/ tests as part of root npm test (#1766)#1767
bokelley merged 2 commits into
mainfrom
fix/ci-workspace-eslint-plugin

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

Summary

Closes #1766. Chains npm test --workspaces --if-present onto the root test script so CI's Test & Build job (which runs npm test) exercises the ESLint plugin's rule tests.

The gap. PR #1752 shipped packages/eslint-plugin/ and PR #1762 added 30 rule tests, but neither wired the plugin's test script into root npm test. CI's Test & Build step ran the SDK tests only — plugin regressions could land on main silently.

The fix. Single-line edit to package.json scripts.test:

- "test": "NODE_ENV=test node --test-timeout=60000 --test-force-exit --test test/*.test.js test/lib/*.test.js",
+ "test": "NODE_ENV=test node --test-timeout=60000 --test-force-exit --test test/*.test.js test/lib/*.test.js && npm test --workspaces --if-present",

--workspaces --if-present invokes the test script in every workspace that defines one, and silently skips those that don't — forward-compatible for any future workspace.

Verification

  • Plugin standalone: cd packages/eslint-plugin && npm test passes 30/30 (3 suites: no-credential-read-from-args).
  • Root invocation: npm test --workspaces --if-present from repo root reaches @adcp/eslint-plugin's test script. Verified the npm dispatch picks it up.
  • packages/client-shim/package.json has no test script — --if-present correctly skips it (no behavior change there, and if it ever adds tests they'll be auto-covered).
  • CI workflow (.github/workflows/ci.yml, line 86 in the Test & Build job) runs npm test directly, so no workflow edit needed.
  • prettier --check clean on changed files.

Test plan

  • CI's Test & Build job runs both SDK tests and @adcp/eslint-plugin tests
  • Future workspace additions with a test script are automatically exercised by CI

🤖 Generated with Claude Code

bokelley and others added 2 commits May 15, 2026 14:09
…1766)

Chain `npm test --workspaces --if-present` onto the root test script so
CI's Test & Build job (which runs `npm test`) exercises the ESLint
plugin's rule tests. Plugin tests landed in PR #1762 but weren't running
in CI, so plugin regressions could land on main silently.

`--workspaces --if-present` is forward-compatible: any future workspace
that adds a `test` script is automatically picked up. `packages/client-shim`
has no `test` script and is correctly skipped.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…icitly

Root package.json declares workspaces as [".", "packages/*"], so
`npm test --workspaces` re-invokes the root test script, which recurses
indefinitely until CI cancels. Switch to an explicit
`--workspace=packages/eslint-plugin` invocation so the plugin tests run
exactly once. Future workspaces with test scripts get appended explicitly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bokelley
Copy link
Copy Markdown
Contributor Author

CI recursion fix

Initial commit used npm test --workspaces --if-present, but the root package.json declares "workspaces": [".", "packages/*"]. is in the workspaces list, so --workspaces re-invokes root's test, which recurses indefinitely. CI's Test & Build cancelled at 13min from the loop.

Fixed by switching to explicit npm test --workspace=packages/eslint-plugin --if-present. Plugin tests run exactly once. New workspaces with test scripts get appended explicitly as a chain — boring and recursion-proof.

@bokelley bokelley merged commit c867257 into main May 15, 2026
10 checks passed
@bokelley bokelley deleted the fix/ci-workspace-eslint-plugin branch May 15, 2026 18:40
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.

fix(ci): wire packages/eslint-plugin/ tests into root Test & Build so plugin changes can't slip past CI

1 participant