@@ -141,15 +141,31 @@ cargo test
141141
142142### Create Test Files
143143
144- ** Single file tests** - Place in ` tests/specs/{group}/{rule}/ ` :
144+ ** Single file tests** - Place in ` tests/specs/{group}/{rule}/ ` under the appropriate ` *_analyze ` crate for the language :
145145
146146```
147147tests/specs/nursery/noVar/
148- ├── invalid.js # Code that triggers the rule
149- ├── valid.js # Code that doesn't trigger
148+ ├── invalid.js # Code that should generate diagnostics
149+ ├── valid.js # Code that should not generate diagnostics
150150└── options.json # Optional: rule configuration
151151```
152152
153+ ** File and folder naming conventions (IMPORTANT):**
154+
155+ - Use ` valid ` or ` invalid ` in file names or parent folder names to indicate expected behaviour.
156+ - Files/folders with ` valid ` in the name (but not ` invalid ` ) are expected to produce ** no diagnostics** .
157+ - Files/folders with ` invalid ` in the name are expected to produce ** diagnostics** .
158+ - When testing cases inside a folder, prefix the name of folder using ` valid ` /` invalid ` e.g. ` validResolutionReact ` /` invalidResolutionReact `
159+
160+ ```
161+ tests/specs/nursery/noShadow/
162+ ├── invalid.js # should generate diagnostics
163+ ├── valid.js # should not generate diagnostics
164+ ├── validResolutionReact/
165+ └───── file.js # should generate diagnostics
166+ └── file2.js # should not generate diagnostics
167+ ```
168+
153169** Multiple test cases** - Use ` .jsonc ` files with arrays:
154170
155171``` jsonc
@@ -182,27 +198,19 @@ tests/specs/nursery/noVar/
182198
183199### Top-Level Comment Convention (REQUIRED)
184200
185- Every JS/TS test spec file ** must** begin with a top-level comment declaring whether it expects diagnostics. The test runner (
186- ` assert_diagnostics_expectation_comment ` in ` biome_test_utils ` ) enforces this and panics if the rules are violated.
201+ Every test spec file ** must** begin with a top-level comment declaring whether it expects diagnostics. The test runner
202+ ( ` assert_diagnostics_expectation_comment ` in ` biome_test_utils ` ) enforces this and panics if the rules are violated.
187203
188- ** For files whose name contains "valid" (but not "invalid"):**
204+ Write the marker text using whatever comment syntax the language under test supports.
205+ For languages that do not support comments at all, rely on the file/folder naming convention (` valid ` /` invalid ` ) instead.
189206
190- ``` js
191- /* should not generate diagnostics */
192- import {foo } from " ./foo.js" ;
193- ```
207+ ** For files whose name contains "valid" (but not "invalid"):**
194208
195- This is ** enforced ** — the test panics if the comment is absent.
209+ The comment is ** mandatory ** — the test panics if it is absent.
196210
197211** For files whose name contains "invalid" (or other names):**
198212
199- ``` js
200- /* should generate diagnostics */
201- var x = 1 ;
202- var y = 2 ;
203- ```
204-
205- This is strongly recommended convention and is also enforced when present: if the comment says
213+ The comment is strongly recommended and is also enforced when present: if the comment says
206214` should generate diagnostics ` but no diagnostics appear, the test panics.
207215
208216** Rules enforced by the test runner:**
0 commit comments