Skip to content

chore: Correct broken --exclude brace expansion in test scripts - #23204

Open
mydea wants to merge 1 commit into
developfrom
fix/test-exclude-brace-expansion
Open

chore: Correct broken --exclude brace expansion in test scripts#23204
mydea wants to merge 1 commit into
developfrom
fix/test-exclude-brace-expansion

Conversation

@mydea

@mydea mydea commented Aug 10, 2026

Copy link
Copy Markdown
Member

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, and test:pr scripts 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 — and browser-integration-tests + bundler-plugin-integration-tests were scheduled and run as part of yarn test.

The fix replaces the brace shorthand with fully-qualified, comma-separated project names. Nx parses a comma-separated --exclude list 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.

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>

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread package.json
"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",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit a4e91f3. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 30.35 kB - -
@sentry/browser - with treeshaking flags 28.52 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 26.85 kB - -
@sentry/browser (incl. Tracing) 48.63 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.64 kB - -
@sentry/browser (incl. Tracing, Profiling) 53.48 kB - -
@sentry/browser (incl. Tracing, Replay) 88.06 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.47 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 92.78 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 105.47 kB - -
@sentry/browser (incl. Feedback) 47.69 kB - -
@sentry/browser (incl. sendFeedback) 35.18 kB - -
@sentry/browser (incl. FeedbackAsync) 40.33 kB - -
@sentry/browser (incl. Metrics) 31.43 kB - -
@sentry/browser (incl. Logs) 31.66 kB - -
@sentry/browser (incl. Metrics & Logs) 32.34 kB - -
@sentry/react 32.14 kB - -
@sentry/react (incl. Tracing) 50.83 kB - -
@sentry/vue 35.45 kB - -
@sentry/vue (incl. Tracing) 50.6 kB - -
@sentry/svelte 30.38 kB - -
CDN Bundle 32.32 kB - -
CDN Bundle (incl. Tracing) 49.6 kB - -
CDN Bundle (incl. Logs, Metrics) 33.84 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 50.9 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.38 kB - -
CDN Bundle (incl. Tracing, Replay) 87.13 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.41 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 92.94 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.19 kB - -
CDN Bundle - uncompressed 95.83 kB - -
CDN Bundle (incl. Tracing) - uncompressed 148.84 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 100.42 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.82 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.34 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 268.09 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 272.06 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 281.79 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.74 kB - -
@sentry/nextjs (client) 53.41 kB - -
@sentry/sveltekit (client) 49.04 kB - -
@sentry/core/server 65.7 kB - -
@sentry/core/browser 52.02 kB - -
@sentry/node 119.48 kB - -
@sentry/node/import (ESM hook with diagnostics-channel injection) 0 B added added
@sentry/node - without tracing 83.46 kB - -
@sentry/aws-serverless 92.76 kB - -
@sentry/cloudflare (withSentry) - minified 214.91 kB - -
@sentry/cloudflare (withSentry) 530.62 kB - -

View base workflow run

@mydea mydea changed the title fix: Correct broken --exclude brace expansion in test scripts chore: Correct broken --exclude brace expansion in test scripts Aug 10, 2026
@mydea
mydea marked this pull request as ready for review August 10, 2026 08:34
@mydea
mydea requested review from Lms24 and s1gr1d August 10, 2026 11:41
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.

3 participants