Skip to content

Commit 50c1850

Browse files
alerizzoclaude
andcommitted
docs(gemini): clarify beforeEach-only env convention in styleguide
The prior wording ("delete it in beforeEach/afterEach") led the reviewer to flag missing afterEach cleanup. Pin it to the actual convention — beforeEach re-assigns the token before every test, so no afterEach is needed — to stop the false positive recurring. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent b3d0411 commit 50c1850

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

.gemini/styleguide.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ Commander.js CLI). Please weigh these before flagging style or correctness
55
concerns.
66

77
## Testing
8-
- Tests mutate `process.env` directly: assign the variable in the test and
9-
`delete` it in `beforeEach`/`afterEach` for isolation. This is the repo-wide
10-
convention (see `src/utils/auth.test.ts` and ~10 other test files). Do **not**
11-
suggest `vi.stubEnv` / `vi.unstubAllEnvs` — the codebase deliberately does not
12-
use them, and consistency across the suite is preferred.
8+
- Tests mutate `process.env` directly: set the variable in `beforeEach` (which
9+
re-assigns it before every test, so leakage between tests is a non-issue) and,
10+
when a specific test needs it unset, `delete` it inside that test. An
11+
`afterEach` cleanup block is **not** required and is **not** the convention —
12+
~13 of the 14 test files (`repositories.test.ts`, `issue.test.ts`,
13+
`findings.test.ts`, …) use `beforeEach` only. Do **not** suggest adding
14+
`afterEach`, and do **not** suggest `vi.stubEnv` / `vi.unstubAllEnvs` — the
15+
codebase deliberately does not use them, and consistency across the suite is
16+
preferred.
1317
- API service calls are mocked with `vi.mock(...)`; tests are co-located as
1418
`<module>.test.ts` next to the source.
1519

0 commit comments

Comments
 (0)