chore: Correct broken --exclude brace expansion in test scripts - #23204
chore: Correct broken --exclude brace expansion in test scripts#23204mydea wants to merge 1 commit into
Conversation
The `test`, `test:unit`, and `test:pr` scripts passed the excluded
packages as a double-quoted brace list. Shell brace expansion does not
happen inside double quotes, so Nx received the string literally and
split it on commas. The first (`@sentry-internal/{browser-integration-tests`)
and last (`bundler-plugin-integration-tests}`) entries retained the
literal braces, matched no project, and were therefore not excluded --
so `browser-integration-tests` and `bundler-plugin-integration-tests`
ran anyway.
Replace the brace shorthand with fully-qualified, comma-separated
project names, which Nx parses natively without relying on the shell.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a4e91f3. Configure here.
| "test:unit": "nx run-many -t test:unit --exclude @sentry-internal/browser-integration-tests,@sentry-internal/bun-integration-tests,@sentry-internal/deno-integration-tests,@sentry-internal/e2e-tests,@sentry-internal/integration-shims,@sentry-internal/node-integration-tests,@sentry-internal/cloudflare-integration-tests,@sentry-internal/bundler-plugin-integration-tests", | ||
| "test:update-snapshots": "nx run-many -t test:update-snapshots", | ||
| "test:pr": "nx affected -t test --exclude \"@sentry-internal/{browser-integration-tests,bun-integration-tests,deno-integration-tests,e2e-tests,integration-shims,node-integration-tests,cloudflare-integration-tests,bundler-plugin-integration-tests}\"", | ||
| "test:pr": "nx affected -t test --exclude @sentry-internal/browser-integration-tests,@sentry-internal/bun-integration-tests,@sentry-internal/deno-integration-tests,@sentry-internal/e2e-tests,@sentry-internal/integration-shims,@sentry-internal/node-integration-tests,@sentry-internal/cloudflare-integration-tests,@sentry-internal/bundler-plugin-integration-tests", |
There was a problem hiding this comment.
Missing regression test for fix
Low Severity
Flagging this because it was mentioned in the review rules file: for a fix PR, Testing Conventions expect at least one unit, integration, or E2E test that fails without the fix and passes with it. This change only updates the test / test:unit / test:pr exclude lists in package.json, with no covering regression test. A small script-level assertion (for example under test:scripts) that the exclude values stay fully qualified and free of brace expansion would lock this in.
Triggered by project rule: PR Review Guidelines for Cursor Bot
Reviewed by Cursor Bugbot for commit a4e91f3. Configure here.
size-limit report 📦
|


TLDR: When running
yarn test, it would also run browser-integration-tests, even though they should be excluded. After investigating it, it turns out the exclusion was not working as it should.The
test,test:unit, andtest:prscripts intended to exclude the standalone integration-test dev-packages via a brace-list:--exclude "@sentry-internal/{browser-integration-tests,...,bundler-plugin-integration-tests}". This never worked as intended.Root cause: shell brace expansion does not occur inside double quotes, so Nx received the string verbatim and split it on commas. Every middle entry happened to match a project by its bare name, but the first entry retained a literal
{(@sentry-internal/{browser-integration-tests) and the last a literal}(bundler-plugin-integration-tests}). Those two matched no project name, so they were silently not excluded — andbrowser-integration-tests+bundler-plugin-integration-testswere scheduled and run as part ofyarn test.The fix replaces the brace shorthand with fully-qualified, comma-separated project names. Nx parses a comma-separated
--excludelist natively, so correctness no longer depends on the shell. Chose this over quoting/escaping tricks because it is unambiguous across shells and matches how Nx documents the flag.Verified: after the change,
yarn test's task graph contains 0 of the eight excluded packages (previously 2 leaked), dropping from 42 to 41 scheduled test tasks.