Commit bd82c7d
authored
fix(require-test-timeout): treat imported bindings as explicit timeouts (#906)
resolveConstTimeout only walked Variable definitions, so an imported
const used as a timeout argument resolved to undefined and the rule
reported a missing timeout. Same-file consts were already accepted via
#887/#889; imports were not.
ImportBinding definitions cannot be resolved cross-file, so accept them
opaquely: if a developer named the imported identifier in the timeout
position, treat it as an explicit timeout and let the rule pass. Same
behaviour as the existing handling for ancestor-scope const bindings.
Tests added (positive + negative axes):
- imported identifier as third-arg timeout (test + it)
- imported identifier in { timeout } object property
- imported identifier as { timeout } options object
- default-imported binding
- importing a binding without using it as a timeout still reports
Closes #8921 parent 28bc45f commit bd82c7d
2 files changed
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
95 | 101 | | |
96 | 102 | | |
97 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
39 | 46 | | |
40 | 47 | | |
41 | 48 | | |
| |||
135 | 142 | | |
136 | 143 | | |
137 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
138 | 151 | | |
139 | 152 | | |
0 commit comments