fix(jest): Use relative path for setupFiles in Jest 30#3193
fix(jest): Use relative path for setupFiles in Jest 30#3193
Conversation
Jest 30 no longer resolves <rootDir>/setupTests.js correctly, causing CI failures on the release branch. Use ./setupTests.js instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bc048a3 to
7561187
Compare
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.
| setupFiles: ['<rootDir>/setupTests.js'], | ||
| testPathIgnorePatterns: ['<rootDir>/src/', '<rootDir>/tests/integration/'], | ||
| setupFiles: ['./setupTests.js'], | ||
| testPathIgnorePatterns: ['./src/', './tests/integration/'], |
There was a problem hiding this comment.
Regex wildcard in testPathIgnorePatterns may over-exclude tests
Medium Severity
testPathIgnorePatterns values are treated as regex patterns matched against absolute file paths, not as file system paths. The . in ./src/ and ./tests/integration/ is a regex wildcard (matching any character), not a literal dot meaning "current directory." While <rootDir> was a special Jest token that got replaced with the actual project root path (yielding a precise pattern like /home/user/sentry-cli/src/), ./src/ is a loose regex matching any path containing <any-char>/src/. If the project lives under a path containing /src/ (e.g., /home/dev/src/sentry-cli/), this pattern would match and exclude all test files. The PR description indicates only setupFiles had the <rootDir> resolution issue — testPathIgnorePatterns may not have needed changing.


Summary
<rootDir>/setupTests.jscorrectly, causingtest:jestto fail withModule <rootDir>/setupTests.js in the setupFiles option was not found./setupTests.jswhich works with both Jest 27 and 30release/3.3.1branch https://github.com/getsentry/sentry-cli/actions/runs/22861477547Test plan
npx jest --listTestsresolves correctly🤖 Generated with Claude Code