-
Notifications
You must be signed in to change notification settings - Fork 0
Gate: pin the test universe #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -353,6 +353,25 @@ broken; the release job simply never tagged. The costs are real anyway: `git log | |
| not resolve, so *what has landed since we shipped* cannot be answered from the repository, and a | ||
| contributor whose work merged has nothing that tells them it reached users. | ||
|
|
||
| ### Pin the test universe | ||
|
|
||
| The test runner's file glob defines what "the suite" is. Pin it to the project's own directories | ||
| (explicit roots or ignore patterns for anything that is not the project: vendored checkouts, | ||
| worktrees, tool scratch space), and treat an unexplained jump in the collected-test count as a | ||
| finding, not a bonus. | ||
|
|
||
| **Caught:** in rnxORM, Jest's default `**/test/**` glob silently collected an abandoned git | ||
| worktree under `.claude/worktrees/` — a dead branch with its own diverged copy of the source. The | ||
|
Comment on lines
+363
to
+364
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -e
printf '%s\n' '--- DELIVERY.md ---'
sed -n '310,328p' DELIVERY.md
printf '%s\n' '--- candidate Jest/package files ---'
git ls-files | grep -E '(^|/)(package\.json|jest[^/]*\.(js|cjs|mjs|ts|json)|.*jest.*|.*package.*)$' | head -80
printf '%s\n' '--- relevant declarations ---'
rg -n --glob '!node_modules' --glob '!dist' --glob '!build' '(testMatch|testPathIgnorePatterns|roots|jest|rnxORM|\*\*/test/\*\*)' . | head -160Repository: BaryoDev/.github Length of output: 2127 🌐 Web query:
💡 Result: Jest's default testMatch configuration is designed to automatically discover test files throughout a project [1][2]. The default patterns are: [ "/tests//.?([mc])[jt]s?(x)", "/?(.)+(spec|test).?([mc])[jt]s?(x)" ] [3][1][2] These patterns instruct Jest to look for: 1. Any files inside folders named tests with extensions like.js,.jsx,.ts,.tsx,.cjs,.mjs,.cts, or.mts [1][2]. 2. Any files that end with.test or.spec (e.g., component.test.ts, util.spec.js) using the same set of supported extensions [1][2]. Regarding the BaryoDev/rnxORM project, official repository documentation and commit history indicate that the project uses standard testing practices [4]. The codebase relies on a structured test directory that organizes tests into subfolders such as test/unit/ and test/integration/ [5][6][4]. Because these files follow the standard naming conventions (e.g., ActualApi.test.ts, ChangeTracker.test.ts), they are automatically detected by Jest's default configuration without requiring custom testMatch patterns [5][6][4][3]. If you find that your project is not picking up these files, ensure your Jest configuration does not define testRegex, as testMatch and testRegex cannot be used simultaneously [1][2][7]. Citations:
Correct the Jest default-glob claim. Jest's default 🤖 Prompt for AI AgentsSource: MCP tools |
||
| run reported 605 tests where the project had 286, with 6 failures coming from code that was not | ||
| shipping and green passes from suites that proved nothing about `main`. It had been that way across | ||
| multiple sessions; a human comparing the count against the documented suite size caught it, nothing | ||
| in the pipeline did. The same glob had been fixed once before on a branch that was later abandoned, | ||
| so the fix was lost too — the gate is the config line in the repository, not the memory of having | ||
| fixed it. | ||
|
|
||
| A number on the test summary that nobody can reconcile with the suite inventory is the same smell | ||
| as a metric with no denominator. | ||
|
|
||
| --- | ||
|
|
||
| ## Say what you actually measured | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: BaryoDev/.github
Length of output: 2086
🌐 Web query:
Jest configuration documentation roots testMatch testPathIgnorePatterns default testMatch💡 Result:
In Jest configuration, the roots, testMatch, and testPathIgnorePatterns options control where Jest looks for tests and which files it executes. roots The roots option defines a list of paths to directories that Jest should use to search for files [1][2]. While rootDir is primarily used as a token for other configuration options, roots is used by Jest internals to locate test files, source files, and manual mocks (such as mocks folders) [1][3][2]. The default value is [""] [1][4]. testMatch The testMatch option defines the glob patterns Jest uses to detect test files [5][3]. By default, it looks for the following patterns [4]: - /tests//.?([mc])[jt]s?(x) - /?(.)+(spec|test).?([mc])[jt]s?(x) This means it automatically detects files inside tests folders, as well as files with a.test,.spec,.js,.jsx,.ts, or.tsx suffix (including those using mjs, cjs, mts, or cts extensions) [5][4]. testPathIgnorePatterns The testPathIgnorePatterns option is an array of regexp pattern strings that are matched against all test paths before execution; if a path matches any pattern, the test is skipped [5][3][2]. The default value is ["/node_modules/"] [5][3][4]. When configuring these patterns, it is recommended to use the string token to include the path to your project's root directory, preventing issues where different environments might have different root paths (e.g., ["/build/", "/node_modules/"]) [5][3].
Citations:
Define the test universe with explicit Jest
roots.testPathIgnorePatternsonly excludes paths that match known patterns. Require explicit project roots and document ignore patterns as defense in depth. Replace “Jest's default**/test/**glob” with the actual configuration, because Jest's documented defaults use__tests__and*.test/*.specpatterns.🤖 Prompt for AI Agents
Source: MCP tools