@hailstails/hone 2.0.0-pre.3 → 2.0.0-pre.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ADOPTING.md +7 -7
- package/CHANGELOG.md +70 -0
- package/MIGRATING.md +15 -6
- package/README.md +12 -13
- package/chunks/chunk-3CWFUD5B.js +38 -0
- package/chunks/chunk-5AKHEW6V.js +15 -0
- package/chunks/chunk-75XWZYNN.js +64 -0
- package/chunks/chunk-7FVSZ2VL.js +1304 -0
- package/chunks/chunk-A3RL4O5V.js +146 -0
- package/chunks/chunk-BIDD2YWP.js +398 -0
- package/chunks/{chunk-GNOMK7CR.js → chunk-BKQ3K766.js} +489 -52
- package/chunks/{chunk-NRIQD3PI.js → chunk-BRANVR7K.js} +3 -5
- package/chunks/chunk-COQMPHWZ.js +37 -0
- package/chunks/{chunk-L7BGRC6D.js → chunk-CXM5KBZX.js} +1 -1
- package/chunks/chunk-D6645WPB.js +6 -0
- package/chunks/chunk-DJMF6JIM.js +42 -0
- package/chunks/{chunk-OKLYWD2Z.js → chunk-E4D5WDRX.js} +27 -20
- package/chunks/chunk-EBX57Z3V.js +8 -0
- package/chunks/chunk-FHVNKG5Q.js +19 -0
- package/chunks/chunk-FPIP7JEC.js +191 -0
- package/chunks/{chunk-QP5TLOBY.js → chunk-HVZVKZPW.js} +12 -9
- package/chunks/chunk-LD766VWU.js +57 -0
- package/chunks/chunk-LEFM7OPS.js +41 -0
- package/chunks/chunk-LNMDMRGQ.js +51 -0
- package/chunks/{chunk-RGSHTPLA.js → chunk-MBEDAFVC.js} +3 -11
- package/chunks/chunk-OO5KV7KN.js +17 -0
- package/chunks/{chunk-ASUN4AVC.js → chunk-PVSC4SE3.js} +71 -5
- package/chunks/chunk-SKDQ3QJD.js +75 -0
- package/chunks/chunk-W5OIAUDW.js +18 -0
- package/chunks/chunk-X73RZUPO.js +63 -0
- package/chunks/chunk-XE2KKWYH.js +45 -0
- package/chunks/chunk-YGMO5Z6U.js +432 -0
- package/chunks/chunk-YONPKP3C.js +15 -0
- package/docs/adding-a-discipline-or-mechanism.md +1 -1
- package/docs/extending.md +7 -388
- package/package.json +7 -6
- package/rules/README.md +2 -2
- package/rules/typescript/checks.md +236 -18
- package/rules/typescript/symptoms/ambient-randomness/random-call.md +10 -0
- package/rules/typescript/symptoms/answer-set-in-a-hook/hook-answer.md +10 -0
- package/rules/typescript/symptoms/assertion-outside-a-test/assertion-site.md +10 -0
- package/rules/typescript/symptoms/assertion-outside-a-test.md +25 -0
- package/rules/typescript/symptoms/built-unit-called-in-place/call-of-a-call.md +10 -0
- package/rules/typescript/symptoms/built-unit-called-in-place.md +25 -0
- package/rules/typescript/symptoms/code-or-prose-read-as-text/raw-read.md +10 -0
- package/rules/typescript/symptoms/code-or-prose-read-as-text.md +31 -0
- package/rules/typescript/symptoms/computed-value-in-a-test/test-body.md +1 -1
- package/rules/typescript/symptoms/double-with-a-body/logic-in-a-passed-function.md +1 -1
- package/rules/typescript/symptoms/double-with-a-body/stub-implementation.md +2 -2
- package/rules/typescript/symptoms/export-from-a-test-file/test-file-export.md +10 -0
- package/rules/typescript/symptoms/export-from-a-test-file.md +33 -0
- package/rules/typescript/symptoms/failure-shaped-as-success/empty-catch.md +10 -0
- package/rules/typescript/symptoms/floating-version/version-selector.md +10 -0
- package/rules/typescript/symptoms/inherited-environment-in-a-subprocess/git-spawn-environment.md +1 -1
- package/rules/typescript/symptoms/many-spellings-of-one-concept/test-call-aliases.md +10 -0
- package/rules/typescript/symptoms/many-spellings-of-one-concept.md +3 -2
- package/rules/typescript/symptoms/module-or-global-patched/module-mock-call.md +4 -4
- package/rules/typescript/symptoms/no-lock-file/committed-lock-file.md +12 -0
- package/rules/typescript/symptoms/process-global-used-in-place/debugger-statement.md +10 -0
- package/rules/typescript/symptoms/process-global-used-in-place/direct-global-use.md +14 -0
- package/rules/typescript/symptoms/process-global-used-in-place.md +1 -1
- package/rules/typescript/symptoms/prose-in-code/comment-prose.md +12 -0
- package/rules/typescript/symptoms/test-switched-off/skipped-tests.md +3 -6
- package/rules/typescript/symptoms/test-switched-off.md +1 -1
- package/rules/typescript/symptoms/throw-between-our-units/throw-statement.md +10 -0
- package/rules/typescript/symptoms/throw-or-catch-in-a-test/throw-statement.md +1 -1
- package/rules/typescript/symptoms/tool-fetched-at-run-time/fetch-command.md +10 -0
- package/rules/typescript/symptoms/type-declared-in-a-test/test-type-declaration.md +10 -0
- package/rules/typescript/symptoms/type-declared-in-a-test.md +33 -0
- package/rules/typescript/symptoms/unit-without-a-running-test/companion-test-file.md +2 -2
- package/rules/typescript/symptoms/wide-input/unread-parameter.md +10 -0
- package/rules/typescript/symptoms/wide-input.md +3 -2
- package/rules/typescript/symptoms.md +183 -121
- package/src/application/conformance/conformance-testing-types.d.ts +13 -16
- package/src/domain/language-layer/authored-item-types.d.ts +50 -0
- package/src/domain/language-layer/catalogue-name.d.ts +5 -0
- package/src/domain/language-layer/check-address-text.d.ts +12 -0
- package/src/domain/rule-set/authored-rule-set-types.d.ts +31 -32
- package/src/domain/rule-set/clause-address-types.d.ts +4 -3
- package/src/domain/rule-set/rule-set-name-of.d.ts +10 -0
- package/src/domain/runner/check-binding.d.ts +18 -0
- package/src/domain/runner/check-observations.d.ts +39 -0
- package/src/domain/runner/conformance-types.d.ts +8 -2
- package/src/domain/settings/test-files.d.ts +7 -0
- package/src/eslint-plugin.js +16 -12
- package/src/hone.js +10677 -10754
- package/src/infrastructure/engines/eslint/authored-class-or-this/static-members-only/piece.json +0 -6
- package/src/infrastructure/engines/eslint/long-function/function-length/piece.json +0 -6
- package/src/infrastructure/engines/eslint/runner/pieces/eslint-piece-settings-types.d.ts +2 -0
- package/src/infrastructure/engines/eslint/runner/runner.js +945 -1188
- package/src/infrastructure/engines/eslint/test-switched-off/focused-tests/README.md +0 -3
- package/src/infrastructure/engines/eslint/test-switched-off/focused-tests/eslint-plugin.js +33 -21
- package/src/infrastructure/engines/eslint/test-switched-off/skipped-tests/piece.json +11 -4
- package/src/infrastructure/engines/eslint/test-switched-off/skipped-tests/skipped-tests.examples.json +28 -0
- package/src/infrastructure/engines/eslint/untyped-value/implicit-any-let/piece.json +0 -2
- package/src/infrastructure/engines/eslint/wide-input/unread-parameter/eslint-plugin.js +94 -0
- package/src/infrastructure/engines/eslint/wide-input/unread-parameter/piece.json +11 -0
- package/src/infrastructure/engines/eslint/wide-input/unread-parameter/unread-parameter.examples.json +48 -0
- package/src/infrastructure/engines/walker/ambient-randomness/random-call/ambient-randomness.js +109 -0
- package/src/infrastructure/engines/walker/ambient-randomness/random-call/piece.json +9 -0
- package/src/infrastructure/engines/walker/ambient-randomness/random-call/random-call.examples.json +48 -0
- package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/hook-answer.examples.json +42 -0
- package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/hook-answers.js +72 -0
- package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/piece.json +9 -0
- package/src/infrastructure/engines/walker/assertion-outside-a-test/assertion-site/assertion-site.examples.json +30 -0
- package/src/infrastructure/engines/walker/assertion-outside-a-test/assertion-site/assertion-site.js +123 -0
- package/src/infrastructure/engines/walker/assertion-outside-a-test/assertion-site/piece.json +9 -0
- package/src/infrastructure/engines/walker/authored-class-or-this/class-keyword/class-syntax.js +3 -3
- package/src/infrastructure/engines/walker/boolean-in-a-signature/boolean-annotation/boolean-signatures.js +7 -5
- package/src/infrastructure/engines/walker/branch-in-a-test/test-body/test-body-logic.js +169 -98
- package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/call-of-a-call.examples.json +24 -0
- package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/call-of-a-call.js +34 -0
- package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/piece.json +9 -0
- package/src/infrastructure/engines/walker/claimed-type/cast-to-any/any-cast.js +6 -4
- package/src/infrastructure/engines/walker/claimed-type/unlisted-cast-site/cast-expressions.js +6 -4
- package/src/infrastructure/engines/walker/code-or-prose-read-as-text/raw-read/piece.json +9 -0
- package/src/infrastructure/engines/walker/code-or-prose-read-as-text/raw-read/raw-read.examples.json +30 -0
- package/src/infrastructure/engines/walker/code-or-prose-read-as-text/raw-read/raw-read.js +166 -0
- package/src/infrastructure/engines/walker/computed-value-in-a-test/test-body/piece.json +0 -10
- package/src/infrastructure/engines/walker/date-used-directly/clock-sources/clock-sources.js +4 -4
- package/src/infrastructure/engines/walker/default-on-a-closed-union/default-arm/switch-defaults.js +8 -6
- package/src/infrastructure/engines/walker/double-with-a-body/logic-in-a-passed-function/piece.json +0 -10
- package/src/infrastructure/engines/walker/double-with-a-body/stub-implementation/dependency-isolation.js +9 -14
- package/src/infrastructure/engines/walker/drawer-path/drawer-names/categorical-paths.js +4 -4
- package/src/infrastructure/engines/walker/export-from-a-test-file/test-file-export/piece.json +9 -0
- package/src/infrastructure/engines/walker/export-from-a-test-file/test-file-export/test-file-export.examples.json +30 -0
- package/src/infrastructure/engines/walker/export-from-a-test-file/test-file-export/test-file-export.js +31 -0
- package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/empty-catch.examples.json +18 -0
- package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/empty-catch.js +32 -0
- package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/piece.json +9 -0
- package/src/infrastructure/engines/walker/floating-version/version-selector/piece.json +9 -0
- package/src/infrastructure/engines/walker/floating-version/version-selector/version-selector.examples.json +54 -0
- package/src/infrastructure/engines/walker/floating-version/version-selector/version-selector.js +75 -0
- package/src/infrastructure/engines/walker/inherited-environment-in-a-subprocess/git-spawn-environment/hermetic-git-spawns.js +8 -17
- package/src/infrastructure/engines/walker/loop-keyword/loop-statement/loops.js +8 -6
- package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/piece.json +9 -0
- package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/test-call-aliases.examples.json +36 -0
- package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/test-call-aliases.js +67 -0
- package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/module-mock-call.examples.json +34 -0
- package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/module-mocking.js +64 -16
- package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/piece.json +5 -1
- package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/committed-lock-file.examples.json +24 -0
- package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/committed-lock-file.js +41 -0
- package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/piece.json +9 -0
- package/src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/import-boundaries.js +18 -16
- package/src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/piece.json +1 -1
- package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/debugger-statement.examples.json +18 -0
- package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/debugger-statement.js +17 -0
- package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/piece.json +9 -0
- package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/direct-global-use.examples.json +63 -0
- package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/piece.json +13 -0
- package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/process-global-used-in-place.js +126 -0
- package/src/infrastructure/engines/walker/prose-in-code/comment-prose/comment-prose.examples.json +42 -0
- package/src/infrastructure/engines/walker/prose-in-code/comment-prose/piece.json +16 -0
- package/src/infrastructure/engines/walker/prose-in-code/comment-prose/prose-in-code.js +90 -0
- package/src/infrastructure/engines/walker/rebinding/test-body/piece.json +0 -10
- package/src/infrastructure/engines/walker/runner/pieces/walker-piece.d.ts +7 -5
- package/src/infrastructure/engines/walker/runner/runner.js +266 -77
- package/src/infrastructure/engines/walker/runner/toolchain/typescript-parse.d.ts +3 -0
- package/src/infrastructure/engines/walker/shorthand-name/identifier-names/identifier-names.js +12 -7
- package/src/infrastructure/engines/walker/strictness-weakened/exact-optional-property-types/piece.json +0 -10
- package/src/infrastructure/engines/walker/strictness-weakened/no-fallthrough-cases-in-switch/piece.json +0 -10
- package/src/infrastructure/engines/walker/strictness-weakened/no-implicit-override/piece.json +0 -10
- package/src/infrastructure/engines/walker/strictness-weakened/no-property-access-from-index-signature/piece.json +0 -10
- package/src/infrastructure/engines/walker/strictness-weakened/no-unchecked-indexed-access/piece.json +0 -10
- package/src/infrastructure/engines/walker/strictness-weakened/strict/compiler-overrides.js +30 -52
- package/src/infrastructure/engines/walker/strictness-weakened/use-unknown-in-catch-variables/piece.json +0 -10
- package/src/infrastructure/engines/walker/text-past-its-reader/test-body/piece.json +0 -10
- package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/piece.json +9 -0
- package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/throw-statement.examples.json +36 -0
- package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/throws-in-production.js +12 -0
- package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement/throw-statement.examples.json +6 -6
- package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement/throws-in-tests.js +5 -44
- package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/try-block/piece.json +0 -10
- package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/fetch-command.examples.json +42 -0
- package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/fetch-command.js +152 -0
- package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/piece.json +9 -0
- package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/piece.json +9 -0
- package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.examples.json +24 -0
- package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.js +27 -0
- package/src/infrastructure/engines/walker/type-derived-from-code/factory-return-types/factory-return-types.js +8 -6
- package/src/infrastructure/engines/walker/unit-without-a-running-test/companion-test-file/export-test-sibling.js +16 -10
- package/src/infrastructure/engines/walker/untracked-escape/directive-pointers/comments-directives.js +18 -64
- package/src/infrastructure/engines/walker/write-into-a-parameter/parameter-mutation/parameter-mutation.js +7 -5
- package/src/rule-set.d.ts +2 -1
- package/src/testing.d.ts +2 -4
- package/src/testing.js +104 -317
- package/src/{audit.d.ts → walker.d.ts} +13 -8
- package/src/walker.js +28 -0
- package/chunks/chunk-5HRMJ4O2.js +0 -608
- package/chunks/chunk-IX2VZTBO.js +0 -887
- package/chunks/chunk-K2W3D3NB.js +0 -17
- package/chunks/chunk-M6SOGWT7.js +0 -82
- package/chunks/chunk-Q62Y25WS.js +0 -843
- package/chunks/chunk-R75QELTA.js +0 -481
- package/chunks/chunk-RANAKCTW.js +0 -31
- package/chunks/chunk-TNY2PASL.js +0 -38
- package/chunks/chunk-UJONWHA4.js +0 -22
- package/docs/output-contract.md +0 -1155
- package/src/audit.js +0 -18
- package/src/domain/runner/runner-module-types.d.ts +0 -15
|
@@ -1,9 +1,40 @@
|
|
|
1
1
|
# Checks in TypeScript
|
|
2
2
|
|
|
3
|
+
## Ambient randomness
|
|
4
|
+
|
|
5
|
+
### random-call
|
|
6
|
+
|
|
7
|
+
- **Engines:** `walker`
|
|
8
|
+
- **Misses:** Local variable aliases, self.crypto, and crypto obtained through ordinary require calls or dynamic imports.
|
|
9
|
+
- **Settings traced to:** None.
|
|
10
|
+
|
|
11
|
+
Direct calls to `Math.random`, `crypto.randomUUID` and `crypto.getRandomValues`. The check follows `globalThis.crypto`, `window.crypto` and static Node crypto imports, including `import = require` and access through a module’s `webcrypto` export. Locally bound receivers from other sources pass.
|
|
12
|
+
|
|
13
|
+
## Answer set in a hook
|
|
14
|
+
|
|
15
|
+
### hook-answer
|
|
16
|
+
|
|
17
|
+
- **Engines:** `walker`
|
|
18
|
+
- **Misses:** Named hook callbacks and alias calls.
|
|
19
|
+
- **Settings traced to:** None.
|
|
20
|
+
|
|
21
|
+
Stub answers set in inline test lifecycle callbacks.
|
|
22
|
+
|
|
23
|
+
## Assertion outside a test
|
|
24
|
+
|
|
25
|
+
### assertion-site
|
|
26
|
+
|
|
27
|
+
- **Engines:** `walker`
|
|
28
|
+
- **Misses:** Assertions called through another wrapper or a Vitest namespace import. A test registered through a shared fixture module or a mutable alias may be reported as outside a test. Asymmetric matchers and extension registration do not assert.
|
|
29
|
+
- **Settings traced to:** None.
|
|
30
|
+
|
|
31
|
+
An assertion in a hook, suite body or helper is detached from the test whose result it should determine. Put it in the case that exercises the behavior.
|
|
32
|
+
|
|
3
33
|
## Authored class or this
|
|
4
34
|
|
|
5
35
|
### class-keyword
|
|
6
36
|
|
|
37
|
+
- **Engines:** `walker`, `eslint`
|
|
7
38
|
- **Misses:** `this` outside a class.
|
|
8
39
|
- **Settings traced to:** none.
|
|
9
40
|
|
|
@@ -31,6 +62,7 @@ Return an object of functions from a factory that closes over its state.
|
|
|
31
62
|
|
|
32
63
|
### static-members-only
|
|
33
64
|
|
|
65
|
+
- **Engines:** `eslint`
|
|
34
66
|
- **Misses:** `this` outside a class.
|
|
35
67
|
- **Settings traced to:** none.
|
|
36
68
|
|
|
@@ -48,6 +80,7 @@ Needs ESLint adopted through the projection.
|
|
|
48
80
|
|
|
49
81
|
### boolean-annotation
|
|
50
82
|
|
|
83
|
+
- **Engines:** `walker`
|
|
51
84
|
- **Flags beyond the symptom:** a predicate's boolean return.
|
|
52
85
|
- **Settings traced to:** none.
|
|
53
86
|
|
|
@@ -77,6 +110,7 @@ Name each state in the type.
|
|
|
77
110
|
|
|
78
111
|
### test-body
|
|
79
112
|
|
|
113
|
+
- **Engines:** `walker`
|
|
80
114
|
- **Flags beyond the symptom:** unit's own API (edition 1).
|
|
81
115
|
- **Settings traced to:** the edition: backwards compatibility for adopters since the npm release.
|
|
82
116
|
|
|
@@ -285,10 +319,21 @@ it.each([
|
|
|
285
319
|
});
|
|
286
320
|
```
|
|
287
321
|
|
|
322
|
+
## Built unit called in place
|
|
323
|
+
|
|
324
|
+
### call-of-a-call
|
|
325
|
+
|
|
326
|
+
- **Engines:** `walker`
|
|
327
|
+
- **Misses:** An object passed through a variable, spread, array or type assertion.
|
|
328
|
+
- **Settings traced to:** None.
|
|
329
|
+
|
|
330
|
+
A call builds a unit from an object literal and immediately calls the result. Give the unit a name before calling it, or pass it to its caller.
|
|
331
|
+
|
|
288
332
|
## Claimed type
|
|
289
333
|
|
|
290
334
|
### cast-to-any
|
|
291
335
|
|
|
336
|
+
- **Engines:** `walker`
|
|
292
337
|
- **Misses:** `any` reached through an outside dependency's types.
|
|
293
338
|
- **Settings traced to:** `as const` allowed: Declared, not asserted.
|
|
294
339
|
|
|
@@ -315,6 +360,7 @@ In a test file, edition 2 of [the test-body check](symptoms/text-past-its-reader
|
|
|
315
360
|
|
|
316
361
|
### non-null-assertions
|
|
317
362
|
|
|
363
|
+
- **Engines:** `eslint`
|
|
318
364
|
- **Misses:** `any` reached through an outside dependency's types.
|
|
319
365
|
- **Settings traced to:** `as const` allowed: Declared, not asserted.
|
|
320
366
|
|
|
@@ -346,6 +392,7 @@ In a test file, [the test-body check](symptoms/branch-in-a-test/test-body.md) fl
|
|
|
346
392
|
|
|
347
393
|
### unlisted-cast-site
|
|
348
394
|
|
|
395
|
+
- **Engines:** `walker`
|
|
349
396
|
- **Misses:** `any` reached through an outside dependency's types.
|
|
350
397
|
- **Settings traced to:** `as const` allowed: Declared, not asserted.
|
|
351
398
|
|
|
@@ -375,10 +422,21 @@ Parse or narrow the value so the type follows from a check rather than from an a
|
|
|
375
422
|
|
|
376
423
|
When handing a value across a boundary truly forces a cast, such as a library that types its schemas loosely or a database driver that returns unparsed rows, put the cast in the one adapter file at that boundary and record that file as an `authorised-location` with a why-chain. With clean boundaries that is one file and one record; casts scattered across many files are the sign the boundary is missing.
|
|
377
424
|
|
|
425
|
+
## Code or prose read as text
|
|
426
|
+
|
|
427
|
+
### raw-read
|
|
428
|
+
|
|
429
|
+
- **Engines:** `walker`
|
|
430
|
+
- **Misses:** Paths supplied through variables or another module, and file systems reached through a `require` result held in a variable.
|
|
431
|
+
- **Settings traced to:** None.
|
|
432
|
+
|
|
433
|
+
The test reads source or prose as text. Assert what the code returns or does. A test that needs to parse source to prove its syntax can record that location.
|
|
434
|
+
|
|
378
435
|
## Computed value in a test
|
|
379
436
|
|
|
380
437
|
### test-body
|
|
381
438
|
|
|
439
|
+
- **Engines:** `walker`
|
|
382
440
|
- **Flags beyond the symptom:** unit's own API (edition 1).
|
|
383
441
|
- **Settings traced to:** the edition: backwards compatibility for adopters since the npm release.
|
|
384
442
|
|
|
@@ -389,7 +447,7 @@ Edition 1:
|
|
|
389
447
|
- A method call with a computing or mutating name, wherever it could be the string or array method of that name: `map`, `filter`, `reduce`, `find`, `forEach`, `join`, `slice`, `split`, `replace`, `includes`, `sort`, `trim`, `keys`, `values`, `push`, `pop`, `splice`, `fill` and similar string and array methods.
|
|
390
448
|
- Not flagged: a call with one of those names whose arguments no string or array method of that name accepts, which makes it the unit's own API. Either it passes an object literal where none of them takes an object, such as `paths.join({ segments: ["a", "b"] })`, or it passes more arguments than any of them takes, such as `screen.keys("x", true, true)`.
|
|
391
449
|
- Still flagged, though they look like that:
|
|
392
|
-
- a call whose receiver traces back to a built-in namespace such as `Object` or `Math`, a package or `node:` module (imported, required or loaded with `import()`), or a string or array literal. The trace follows variables declared in the test file, including names destructured from a traced module or namespace, such as `posix` after `const { posix } = path`, and a property read directly off an object literal declared there, such as `deps.path` after `const deps = { path }`;
|
|
450
|
+
- a call whose receiver traces back to a built-in namespace such as `Object` or `Math`, a package or `node:` module (imported, required or loaded with `import()`) other than a `#` import or a package some `package.json` in the repository names, or a string or array literal. The trace follows variables declared in the test file, including names destructured from a traced module or namespace, such as `posix` after `const { posix } = path`, and a property read directly off an object literal declared there, such as `deps.path` after `const deps = { path }`;
|
|
393
451
|
- a call that spreads its arguments;
|
|
394
452
|
- an object at a position where a string or array method takes one, such as `rows.includes({ id: "a" })`, `rows.push({ id: "a" })`, `rows.reduce(sum, { total: 0 })`, `rows.find(isA, {})` or `text.split({ [Symbol.split]: splitter })`.
|
|
395
453
|
- What this check cannot know: it reads names and syntax, not types, so it cannot tell what a receiver is.
|
|
@@ -522,6 +580,7 @@ expect(roundedOf(2.5)).toBe(3);
|
|
|
522
580
|
|
|
523
581
|
### clock-sources
|
|
524
582
|
|
|
583
|
+
- **Engines:** `walker`
|
|
525
584
|
- **Flags beyond the symptom:** `Date.now` in comments and strings.
|
|
526
585
|
- **Misses:** `performance.now()`.
|
|
527
586
|
- **Settings traced to:** none.
|
|
@@ -552,6 +611,7 @@ Accept a clock as a dependency and read time only through it. The one real imple
|
|
|
552
611
|
|
|
553
612
|
### default-arm
|
|
554
613
|
|
|
614
|
+
- **Engines:** `walker`
|
|
555
615
|
- **Flags beyond the symptom:** a `switch` over an open set.
|
|
556
616
|
- **Settings traced to:** none.
|
|
557
617
|
|
|
@@ -583,8 +643,9 @@ Name each remaining variant so the compiler checks exhaustiveness.
|
|
|
583
643
|
|
|
584
644
|
### logic-in-a-passed-function
|
|
585
645
|
|
|
646
|
+
- **Engines:** `walker`
|
|
586
647
|
- **Misses:** hand-written doubles.
|
|
587
|
-
- **Settings traced to:** test
|
|
648
|
+
- **Settings traced to:** test files are what `testFiles` declares: the adopter's convention.
|
|
588
649
|
|
|
589
650
|
A construct any other test-body check flags, inside a function a test passes on. These run with the other [test-body checks](../README.md#checks-the-test-body-checks), which share their scope, editions and settings.
|
|
590
651
|
|
|
@@ -612,14 +673,15 @@ The recipe is [Stub with vi.fn](recipes/stub-with-vifn.md).
|
|
|
612
673
|
|
|
613
674
|
### stub-implementation
|
|
614
675
|
|
|
676
|
+
- **Engines:** `walker`
|
|
615
677
|
- **Misses:** hand-written doubles.
|
|
616
|
-
- **Settings traced to:** test
|
|
678
|
+
- **Settings traced to:** test files are what `testFiles` declares: the adopter's convention.
|
|
617
679
|
|
|
618
680
|
`vi.fn(<implementation>)` and `.mockImplementation(...)`.
|
|
619
681
|
|
|
620
682
|
## Flags
|
|
621
683
|
|
|
622
|
-
- Test files only:
|
|
684
|
+
- Test files only: the `.ts` and `.tsx` files `testFiles` names. Generated folders such as `node_modules`, `dist`, `build` and `coverage` are skipped.
|
|
623
685
|
- A `vi.fn(...)` call with any argument, and any call to a method named `mockImplementation` (on any receiver, with or without arguments).
|
|
624
686
|
- Allowed: `vi.fn()`, `.mockReturnValue(...)`, `.mockResolvedValue(...)`, `.mockReturnValueOnce(...)` and `.mockImplementationOnce(...)`.
|
|
625
687
|
- `.mockImplementationOnce(...)` is not flagged even though it takes an implementation; whether that implementation gives the double behaviour is left to review.
|
|
@@ -642,6 +704,7 @@ Return a canned value: that double is a stub. If the double needs logic, the sea
|
|
|
642
704
|
|
|
643
705
|
### drawer-names
|
|
644
706
|
|
|
707
|
+
- **Engines:** `walker`
|
|
645
708
|
- **Misses:** a drawer under an ordinary name.
|
|
646
709
|
- **Settings traced to:** drawer names: Screaming folders recipe.
|
|
647
710
|
|
|
@@ -665,10 +728,41 @@ src/price-formatting.ts
|
|
|
665
728
|
```
|
|
666
729
|
Rename the file or folder for what it contains, or split it into files that each hold one thing.
|
|
667
730
|
|
|
731
|
+
## Export from a test file
|
|
732
|
+
|
|
733
|
+
### test-file-export
|
|
734
|
+
|
|
735
|
+
- **Engines:** `walker`
|
|
736
|
+
- **Misses:** An ordinary source file imported exclusively by tests.
|
|
737
|
+
- **Settings traced to:** None.
|
|
738
|
+
|
|
739
|
+
A test file exports a value or type that other files can import. Keep the companion test self-contained and put reusable production code in the module that owns it.
|
|
740
|
+
|
|
741
|
+
## Failure shaped as success
|
|
742
|
+
|
|
743
|
+
### empty-catch
|
|
744
|
+
|
|
745
|
+
- **Engines:** `walker`
|
|
746
|
+
- **Misses:** A handler that returns a success-shaped default or whose body cannot be seen at the call site.
|
|
747
|
+
- **Settings traced to:** None.
|
|
748
|
+
|
|
749
|
+
An empty catch block or promise rejection handler drops the failure so callers can continue as if the operation succeeded. Return a failure value or leave handling to the boundary that can act on it.
|
|
750
|
+
|
|
751
|
+
## Floating version
|
|
752
|
+
|
|
753
|
+
### version-selector
|
|
754
|
+
|
|
755
|
+
- **Engines:** `walker`
|
|
756
|
+
- **Misses:** Versions provided through workflow matrix expressions.
|
|
757
|
+
- **Settings traced to:** None.
|
|
758
|
+
|
|
759
|
+
Floating versions the repository runs, including development dependencies, private package dependencies, package managers, and workflow tools. Published dependency and peer ranges can express compatibility.
|
|
760
|
+
|
|
668
761
|
## Inherited environment in a subprocess
|
|
669
762
|
|
|
670
763
|
### git-spawn-environment
|
|
671
764
|
|
|
765
|
+
- **Engines:** `walker`
|
|
672
766
|
- **Misses:** `env` built from `process.env` under an accepted name.
|
|
673
767
|
- **Settings traced to:** accepted helper names: **nothing**; `.spec`, `.js`, `.mjs` test files: **nothing**.
|
|
674
768
|
|
|
@@ -676,7 +770,7 @@ A git spawn in a test without a hermetic `env`.
|
|
|
676
770
|
|
|
677
771
|
## Flags
|
|
678
772
|
|
|
679
|
-
- Test files:
|
|
773
|
+
- Test files: the `.ts`, `.tsx`, `.mjs` and `.js` files `testFiles` names. Generated folders (`node_modules`, `dist`, `build`, `coverage`, `.git`, root `vendor`) are skipped; any other folder can be left out with `exclude` in disciplines.json.
|
|
680
774
|
- A line calling `spawnSync`, `spawn`, `execFileSync`, `execFile`, `execSync`, `exec`, `execa` or `execaSync` with `"git"` (or `'git'`, or a template literal) as the first argument.
|
|
681
775
|
- Allowed when, within that line and the next seven, an `env:` names `hermeticGitEnvironment`, `withoutInheritedGitBindings` or `environment`, and no nearby `env:` uses `process.env`. The environment comes from a unit of ours with its own test, not a test helper.
|
|
682
776
|
- Not detected: a command string such as `execSync("git status")`, a split call, or a non-literal command. Whether the spawn is warranted at all is left to review.
|
|
@@ -698,6 +792,7 @@ Build the environment without inherited git variables or the user's configuratio
|
|
|
698
792
|
|
|
699
793
|
### function-length
|
|
700
794
|
|
|
795
|
+
- **Engines:** `eslint`
|
|
701
796
|
- **Settings traced to:** 50 lines: where a broad symptom fires. "Line and complexity are symptoms that flag many things." Suite bodies not measured: "A test suite's body is a list of cases, not a coordinator.".
|
|
702
797
|
|
|
703
798
|
A function body longer than 50 lines.
|
|
@@ -744,6 +839,7 @@ Move any computing or branching between calls into a named doer, so the orchestr
|
|
|
744
839
|
|
|
745
840
|
### loop-statement
|
|
746
841
|
|
|
842
|
+
- **Engines:** `walker`
|
|
747
843
|
- **Settings traced to:** none.
|
|
748
844
|
|
|
749
845
|
`for...of`, `for await`, counted `for` and `while` loops.
|
|
@@ -773,18 +869,29 @@ Replace a counted loop with `Array.from({ length }, (_, position) => ...)`.
|
|
|
773
869
|
|
|
774
870
|
In a test file, the [computed-value-in-a-test check](symptoms/computed-value-in-a-test/test-body.md) flags `map` at either edition, and its edition 2 flags `Array.from`: write the values out instead, as [the allowed forms in a test](symptoms/computed-value-in-a-test/test-body.md#allowed-forms-in-a-test) show.
|
|
775
871
|
|
|
872
|
+
## Many spellings of one concept
|
|
873
|
+
|
|
874
|
+
### test-call-aliases
|
|
875
|
+
|
|
876
|
+
- **Engines:** `walker`
|
|
877
|
+
- **Misses:** Calls through a different local alias or a Vitest namespace import.
|
|
878
|
+
- **Settings traced to:** None.
|
|
879
|
+
|
|
880
|
+
In a test file, a call rooted at `test` or `suite` refers to Vitest or has no local binding. Use `it` and `describe` so tests use the same names. Local bindings with other meanings pass.
|
|
881
|
+
|
|
776
882
|
## Module or global patched
|
|
777
883
|
|
|
778
884
|
### module-mock-call
|
|
779
885
|
|
|
780
|
-
- **
|
|
781
|
-
- **
|
|
886
|
+
- **Engines:** `walker`
|
|
887
|
+
- **Misses:** Both editions miss aliased receivers and module mocks such as vi.doMock or vi["mock"]. Edition 1 leaves global patches to review. Edition 2 still misses indirect writes and global vi.spyOn calls.
|
|
888
|
+
- **Settings traced to:** test files are what `testFiles` declares: the adopter's convention.
|
|
782
889
|
|
|
783
|
-
Calls to `vi.mock`.
|
|
890
|
+
Calls to `vi.mock`. Edition 2 also flags `vi.stubGlobal`, `vi.stubEnv` and direct changes to `process.env` in test files, including assignments, deletes, increments and decrements.
|
|
784
891
|
|
|
785
892
|
## Flags
|
|
786
893
|
|
|
787
|
-
- Test files only:
|
|
894
|
+
- Test files only: the `.ts` and `.tsx` files `testFiles` names. Generated folders such as `node_modules`, `dist`, `build` and `coverage` are skipped.
|
|
788
895
|
- Every call spelled `vi.mock(...)`, with or without arguments.
|
|
789
896
|
- Not detected: `vi.doMock`, `jest.mock`, `vitest.mock` and `vi["mock"]`. Those are left to review.
|
|
790
897
|
|
|
@@ -805,6 +912,7 @@ Pass the collaborator in as a dependency and hand the test a stub.
|
|
|
805
912
|
|
|
806
913
|
### filename-case
|
|
807
914
|
|
|
915
|
+
- **Engines:** `eslint`
|
|
808
916
|
- **Settings traced to:** Hone's own casing option lists: **nothing**; casing is the adopter's own lint.
|
|
809
917
|
|
|
810
918
|
A file name that is not kebab-case or PascalCase.
|
|
@@ -818,6 +926,7 @@ Needs ESLint adopted through the projection.
|
|
|
818
926
|
|
|
819
927
|
### naming-convention
|
|
820
928
|
|
|
929
|
+
- **Engines:** `eslint`
|
|
821
930
|
- **Settings traced to:** Hone's own casing option lists: **nothing**; casing is the adopter's own lint.
|
|
822
931
|
|
|
823
932
|
A name that breaks the naming convention for its kind.
|
|
@@ -833,10 +942,23 @@ Needs ESLint adopted through the projection.
|
|
|
833
942
|
- Ignored: names that need quotes, destructured bindings, imports and unused bindings whose name starts with `_`.
|
|
834
943
|
- Not checked, unlike Biome: the local name of a renamed named import (`import { a as b }`) and a `catch` parameter. typescript-eslint has no selector for either; review covers them.
|
|
835
944
|
|
|
945
|
+
## No lock file
|
|
946
|
+
|
|
947
|
+
### committed-lock-file
|
|
948
|
+
|
|
949
|
+
- **Engines:** `walker`
|
|
950
|
+
- **Misses:** Package managers with an unrecognised lock file. Workspace membership is not verified.
|
|
951
|
+
- **Settings traced to:** None.
|
|
952
|
+
|
|
953
|
+
Dependencies declared without an applicable tracked lock file.
|
|
954
|
+
|
|
955
|
+
A recognised tracked lock file covers manifests in its directory and below, including a root lock.
|
|
956
|
+
|
|
836
957
|
## Outside import past a boundary
|
|
837
958
|
|
|
838
959
|
### import-or-require
|
|
839
960
|
|
|
961
|
+
- **Engines:** `walker`
|
|
840
962
|
- **Misses:** `import()`, `require`, globals.
|
|
841
963
|
- **Settings traced to:** `confinedPackages`, empty by default on purpose: the universe of outside dependencies cannot be listed, and flagging every import would catch internal packages. Telling outside from internal needs the workspace layout, which Hone can read.
|
|
842
964
|
|
|
@@ -880,6 +1002,7 @@ Import your own port and take it in the unit's argument. Only the adapter for th
|
|
|
880
1002
|
|
|
881
1003
|
### parameter-count
|
|
882
1004
|
|
|
1005
|
+
- **Engines:** `eslint`
|
|
883
1006
|
- **Misses:** our own functions with exactly two parameters.
|
|
884
1007
|
- **Settings traced to:** `max: 2`: a recorded compromise of the check, which cannot tell the two kinds apart. "Positional parameters is 2 because it flags functions designed to be used in native APIs even inline unnamed ones for things like map/reduce. Making 1 untenable."; "The check is not right. Its unable to distinguish.".
|
|
885
1008
|
|
|
@@ -905,10 +1028,45 @@ const createOrder = ({ customerId, items, currency }: OrderRequest) => ({ custom
|
|
|
905
1028
|
```
|
|
906
1029
|
Take one object with named fields so each call site reads as a labelled contract.
|
|
907
1030
|
|
|
1031
|
+
## Process global used in place
|
|
1032
|
+
|
|
1033
|
+
### debugger-statement
|
|
1034
|
+
|
|
1035
|
+
- **Engines:** `walker`
|
|
1036
|
+
- **Misses:** Debugger activation through a runtime API.
|
|
1037
|
+
- **Settings traced to:** None.
|
|
1038
|
+
|
|
1039
|
+
A `debugger` statement can pause execution through the runtime. Keep that effect at the process boundary and pass any needed diagnostic capability in through a port.
|
|
1040
|
+
|
|
1041
|
+
### direct-global-use
|
|
1042
|
+
|
|
1043
|
+
- **Engines:** `walker`
|
|
1044
|
+
- **Misses:** Destructured aliases, indirect calls or references, and dialog calls through other receivers or parenthesised receivers.
|
|
1045
|
+
- **Settings traced to:** The edition preserves compatibility for existing selections.
|
|
1046
|
+
|
|
1047
|
+
Direct reads of process globals and direct console use.
|
|
1048
|
+
|
|
1049
|
+
A locally supplied value with the same name passes. Reads of globals still report after an ambient declaration or a canonical Node import or require.
|
|
1050
|
+
|
|
1051
|
+
Edition 2 also covers unbound `alert`, `confirm`, and `prompt` calls, including calls on the unbound `window` global.
|
|
1052
|
+
|
|
1053
|
+
## Prose in code
|
|
1054
|
+
|
|
1055
|
+
### comment-prose
|
|
1056
|
+
|
|
1057
|
+
- **Engines:** `walker`
|
|
1058
|
+
- **Misses:** Comments in JavaScript files.
|
|
1059
|
+
- **Settings traced to:** `trackerPatterns` reference forms: **nothing**.
|
|
1060
|
+
|
|
1061
|
+
Prose in TypeScript line or block comments, including JSDoc.
|
|
1062
|
+
|
|
1063
|
+
A tracked TODO may contain only its pointer. `trackerPatterns` chooses which numbered references and URLs count.
|
|
1064
|
+
|
|
908
1065
|
## Rebinding
|
|
909
1066
|
|
|
910
1067
|
### parameter-reassignment
|
|
911
1068
|
|
|
1069
|
+
- **Engines:** `eslint`
|
|
912
1070
|
- **Misses:** a local `let` in production.
|
|
913
1071
|
- **Settings traced to:** none.
|
|
914
1072
|
|
|
@@ -924,6 +1082,7 @@ Needs ESLint adopted through the projection; see the ESLint piece.
|
|
|
924
1082
|
|
|
925
1083
|
### test-body
|
|
926
1084
|
|
|
1085
|
+
- **Engines:** `walker`
|
|
927
1086
|
- **Misses:** a local `let` in production.
|
|
928
1087
|
- **Settings traced to:** none.
|
|
929
1088
|
|
|
@@ -955,6 +1114,7 @@ expect(save).toHaveBeenCalledWith("a");
|
|
|
955
1114
|
|
|
956
1115
|
### identifier-names
|
|
957
1116
|
|
|
1117
|
+
- **Engines:** `walker`
|
|
958
1118
|
- **Misses:** shorthand not on the list.
|
|
959
1119
|
- **Settings traced to:** shorthand and filler list: Whole words recipe.
|
|
960
1120
|
|
|
@@ -983,6 +1143,7 @@ Name the value for what it is in the domain.
|
|
|
983
1143
|
|
|
984
1144
|
### exact-optional-property-types
|
|
985
1145
|
|
|
1146
|
+
- **Engines:** `walker`
|
|
986
1147
|
- **Flags beyond the symptom:** edition 1: a flag set to `true`.
|
|
987
1148
|
- **Misses:** edition 1: a base reached by `extends`.
|
|
988
1149
|
- **Settings traced to:** flag list: The type checker proves it. Edition 1 flags presence, which is the Shared strict base config recipe: **traced to a recipe, not a rule**.
|
|
@@ -1031,6 +1192,7 @@ Put the flags in a shared base file that is not named `tsconfig.json`, and leave
|
|
|
1031
1192
|
|
|
1032
1193
|
### no-fallthrough-cases-in-switch
|
|
1033
1194
|
|
|
1195
|
+
- **Engines:** `walker`
|
|
1034
1196
|
- **Flags beyond the symptom:** edition 1: a flag set to `true`.
|
|
1035
1197
|
- **Misses:** edition 1: a base reached by `extends`.
|
|
1036
1198
|
- **Settings traced to:** flag list: The type checker proves it. Edition 1 flags presence, which is the Shared strict base config recipe: **traced to a recipe, not a rule**.
|
|
@@ -1079,6 +1241,7 @@ Put the flags in a shared base file that is not named `tsconfig.json`, and leave
|
|
|
1079
1241
|
|
|
1080
1242
|
### no-implicit-override
|
|
1081
1243
|
|
|
1244
|
+
- **Engines:** `walker`
|
|
1082
1245
|
- **Flags beyond the symptom:** edition 1: a flag set to `true`.
|
|
1083
1246
|
- **Misses:** edition 1: a base reached by `extends`.
|
|
1084
1247
|
- **Settings traced to:** flag list: The type checker proves it. Edition 1 flags presence, which is the Shared strict base config recipe: **traced to a recipe, not a rule**.
|
|
@@ -1127,6 +1290,7 @@ Put the flags in a shared base file that is not named `tsconfig.json`, and leave
|
|
|
1127
1290
|
|
|
1128
1291
|
### no-property-access-from-index-signature
|
|
1129
1292
|
|
|
1293
|
+
- **Engines:** `walker`
|
|
1130
1294
|
- **Flags beyond the symptom:** edition 1: a flag set to `true`.
|
|
1131
1295
|
- **Misses:** edition 1: a base reached by `extends`.
|
|
1132
1296
|
- **Settings traced to:** flag list: The type checker proves it. Edition 1 flags presence, which is the Shared strict base config recipe: **traced to a recipe, not a rule**.
|
|
@@ -1175,6 +1339,7 @@ Put the flags in a shared base file that is not named `tsconfig.json`, and leave
|
|
|
1175
1339
|
|
|
1176
1340
|
### no-unchecked-indexed-access
|
|
1177
1341
|
|
|
1342
|
+
- **Engines:** `walker`
|
|
1178
1343
|
- **Flags beyond the symptom:** edition 1: a flag set to `true`.
|
|
1179
1344
|
- **Misses:** edition 1: a base reached by `extends`.
|
|
1180
1345
|
- **Settings traced to:** flag list: The type checker proves it. Edition 1 flags presence, which is the Shared strict base config recipe: **traced to a recipe, not a rule**.
|
|
@@ -1223,6 +1388,7 @@ Put the flags in a shared base file that is not named `tsconfig.json`, and leave
|
|
|
1223
1388
|
|
|
1224
1389
|
### strict
|
|
1225
1390
|
|
|
1391
|
+
- **Engines:** `walker`
|
|
1226
1392
|
- **Flags beyond the symptom:** edition 1: a flag set to `true`.
|
|
1227
1393
|
- **Misses:** edition 1: a base reached by `extends`.
|
|
1228
1394
|
- **Settings traced to:** flag list: The type checker proves it. Edition 1 flags presence, which is the Shared strict base config recipe: **traced to a recipe, not a rule**.
|
|
@@ -1271,6 +1437,7 @@ Put the flags in a shared base file that is not named `tsconfig.json`, and leave
|
|
|
1271
1437
|
|
|
1272
1438
|
### use-unknown-in-catch-variables
|
|
1273
1439
|
|
|
1440
|
+
- **Engines:** `walker`
|
|
1274
1441
|
- **Flags beyond the symptom:** edition 1: a flag set to `true`.
|
|
1275
1442
|
- **Misses:** edition 1: a base reached by `extends`.
|
|
1276
1443
|
- **Settings traced to:** flag list: The type checker proves it. Edition 1 flags presence, which is the Shared strict base config recipe: **traced to a recipe, not a rule**.
|
|
@@ -1321,6 +1488,7 @@ Put the flags in a shared base file that is not named `tsconfig.json`, and leave
|
|
|
1321
1488
|
|
|
1322
1489
|
### cognitive-complexity
|
|
1323
1490
|
|
|
1491
|
+
- **Engines:** `eslint`
|
|
1324
1492
|
- **Settings traced to:** complexity 15: where a broad symptom fires (as above).
|
|
1325
1493
|
|
|
1326
1494
|
A function whose cognitive complexity is above 15.
|
|
@@ -1362,6 +1530,7 @@ Move any computing or branching between calls into a named doer, so the orchestr
|
|
|
1362
1530
|
|
|
1363
1531
|
### focused-tests
|
|
1364
1532
|
|
|
1533
|
+
- **Engines:** `eslint`
|
|
1365
1534
|
- **Misses:** `.todo`.
|
|
1366
1535
|
- **Settings traced to:** `.todo` not flagged: a miss.
|
|
1367
1536
|
|
|
@@ -1374,20 +1543,19 @@ Needs ESLint adopted through the projection.
|
|
|
1374
1543
|
|
|
1375
1544
|
### skipped-tests
|
|
1376
1545
|
|
|
1377
|
-
- **
|
|
1378
|
-
- **
|
|
1546
|
+
- **Engines:** `eslint`
|
|
1547
|
+
- **Misses:** Test calls made through aliased names.
|
|
1548
|
+
- **Settings traced to:** The edition preserves the published edition 1 behaviour for adopters.
|
|
1379
1549
|
|
|
1380
|
-
`.skip
|
|
1550
|
+
Edition 1 flags `.skip`, `.fixme`, `xdescribe`, `xit`, `xtest` and `xsuite`. Edition 2 also flags `.todo`, `.skipIf` and `.runIf`. A test should run wherever the suite runs.
|
|
1381
1551
|
|
|
1382
|
-
## Flags
|
|
1383
1552
|
Needs ESLint adopted through the projection.
|
|
1384
|
-
- Under ESLint, this check flags `.skip` and `.fixme` on those chains, and the bare names `xdescribe`, `xit`, `xtest` and `xsuite`.
|
|
1385
|
-
- Not flagged: `.todo`, `.concurrent` and `.each`.
|
|
1386
1553
|
|
|
1387
1554
|
## Text past its reader
|
|
1388
1555
|
|
|
1389
1556
|
### test-body
|
|
1390
1557
|
|
|
1558
|
+
- **Engines:** `walker`
|
|
1391
1559
|
- **Misses:** production sites.
|
|
1392
1560
|
- **Settings traced to:** the edition: backwards compatibility for adopters since the npm release.
|
|
1393
1561
|
|
|
@@ -1413,17 +1581,28 @@ expect(rowOf({ id: "a" })).toEqual({ id: "a" });
|
|
|
1413
1581
|
|
|
1414
1582
|
A unit that gives back only text should hand over an object, leaving the text to the adapter at its edge.
|
|
1415
1583
|
|
|
1584
|
+
## Throw between our units
|
|
1585
|
+
|
|
1586
|
+
### throw-statement
|
|
1587
|
+
|
|
1588
|
+
- **Engines:** `walker`
|
|
1589
|
+
- **Misses:** A throw in a called function or a test file.
|
|
1590
|
+
- **Settings traced to:** None.
|
|
1591
|
+
|
|
1592
|
+
A throw statement in production TypeScript.
|
|
1593
|
+
|
|
1416
1594
|
## Throw or catch in a test
|
|
1417
1595
|
|
|
1418
1596
|
### throw-statement
|
|
1419
1597
|
|
|
1598
|
+
- **Engines:** `walker`
|
|
1420
1599
|
- **Misses:** `catch`.
|
|
1421
1600
|
- **Settings traced to:** none.
|
|
1422
1601
|
|
|
1423
1602
|
A `throw` statement in a test file.
|
|
1424
1603
|
|
|
1425
1604
|
## Flags
|
|
1426
|
-
- Test files only:
|
|
1605
|
+
- Test files only: the `.ts` and `.tsx` files `testFiles` names. `.js` tests are not read. Generated folders such as `node_modules`, `dist`, `build` and `coverage` are skipped.
|
|
1427
1606
|
- Every `throw` statement, wherever it sits in the file.
|
|
1428
1607
|
- Allowed: assertion calls such as `expect(...)`.
|
|
1429
1608
|
- The source rule also confines throwing in production code to a closed list of contexts. The check does not look at production files; that part is left to review.
|
|
@@ -1446,6 +1625,7 @@ Assert on the whole result. Branching in tests is also reported by [the branch-i
|
|
|
1446
1625
|
|
|
1447
1626
|
### try-block
|
|
1448
1627
|
|
|
1628
|
+
- **Engines:** `walker`
|
|
1449
1629
|
- **Misses:** `catch`.
|
|
1450
1630
|
- **Settings traced to:** none.
|
|
1451
1631
|
|
|
@@ -1484,6 +1664,7 @@ it("refuses a missing file", async () => {
|
|
|
1484
1664
|
|
|
1485
1665
|
### throw-only-error
|
|
1486
1666
|
|
|
1667
|
+
- **Engines:** `eslint`
|
|
1487
1668
|
- **Settings traced to:** none.
|
|
1488
1669
|
|
|
1489
1670
|
A `throw` of something that is not an error object.
|
|
@@ -1494,10 +1675,31 @@ Needs ESLint adopted through the projection.
|
|
|
1494
1675
|
- Allowed: `new Error(...)`, identifiers, calls and member access.
|
|
1495
1676
|
- This clause applies to every file the ESLint run includes, not only tests.
|
|
1496
1677
|
|
|
1678
|
+
## Tool fetched at run time
|
|
1679
|
+
|
|
1680
|
+
### fetch-command
|
|
1681
|
+
|
|
1682
|
+
- **Engines:** `walker`
|
|
1683
|
+
- **Misses:** Indirect commands composed through aliases or variables and commands split across physical lines.
|
|
1684
|
+
- **Settings traced to:** None.
|
|
1685
|
+
|
|
1686
|
+
Direct fetch-and-run commands in package scripts, CI workflows, and shell scripts.
|
|
1687
|
+
|
|
1688
|
+
## Type declared in a test
|
|
1689
|
+
|
|
1690
|
+
### test-type-declaration
|
|
1691
|
+
|
|
1692
|
+
- **Engines:** `walker`
|
|
1693
|
+
- **Misses:** Inline type literals and declarations in ordinary source files imported only by tests.
|
|
1694
|
+
- **Settings traced to:** None.
|
|
1695
|
+
|
|
1696
|
+
A test declares a type, interface or enum of its own. Import the contract owned by the unit or its boundary so the test and the unit rely on the same type. Module and global augmentations are allowed.
|
|
1697
|
+
|
|
1497
1698
|
## Type derived from code
|
|
1498
1699
|
|
|
1499
1700
|
### factory-return-types
|
|
1500
1701
|
|
|
1702
|
+
- **Engines:** `walker`
|
|
1501
1703
|
- **Flags beyond the symptom:** text in comments.
|
|
1502
1704
|
- **Misses:** `Parameters<typeof>`, `typeof` alone.
|
|
1503
1705
|
- **Settings traced to:** none.
|
|
@@ -1526,6 +1728,7 @@ Declare and export the type, then annotate the factory with it.
|
|
|
1526
1728
|
|
|
1527
1729
|
### companion-test-file
|
|
1528
1730
|
|
|
1731
|
+
- **Engines:** `walker`
|
|
1529
1732
|
- **Misses:** an empty or non-running sibling.
|
|
1530
1733
|
- **Settings traced to:** `__tests__` skipped by default, on purpose (noise; the practice is not adopted). `exclude` is scope.
|
|
1531
1734
|
|
|
@@ -1533,8 +1736,8 @@ A production file with a runtime export and no `.test` sibling.
|
|
|
1533
1736
|
|
|
1534
1737
|
## Flags
|
|
1535
1738
|
|
|
1536
|
-
- Production `.ts` and `.tsx` files. Skipped:
|
|
1537
|
-
- A file with a runtime export (`export const`, `function`, `class`, `enum`, `export default`, or `export { name }`) and no `<name>.
|
|
1739
|
+
- Production `.ts` and `.tsx` files. Skipped: the test files `testFiles` names, `.d.ts` and anything under `__tests__`. Generated folders (`node_modules`, `dist`, `build`, `coverage`, `.git`, root `vendor`) are skipped; any other folder or file can be left out with `exclude` in disciplines.json.
|
|
1740
|
+
- A file with a runtime export (`export const`, `function`, `class`, `enum`, `export default`, or `export { name }`) and no `<name>.<suffix>.ts` beside it (`.tsx` for `.tsx`), for any suffix `testFiles` lists. The sibling must be in the repository's file list.
|
|
1538
1741
|
- Allowed: files with only `export type`, `export interface`, `export declare`, type-only named exports or `export * from`, and files with no exports.
|
|
1539
1742
|
- The source rule asks for a test beside every source file; files without runtime exports are left to review.
|
|
1540
1743
|
|
|
@@ -1553,6 +1756,7 @@ Add `src/price.test.ts` next to the file, with at least one test of its behaviou
|
|
|
1553
1756
|
|
|
1554
1757
|
### directive-pointers
|
|
1555
1758
|
|
|
1759
|
+
- **Engines:** `walker`
|
|
1556
1760
|
- **Settings traced to:** reference form "need a digit": **nothing**.
|
|
1557
1761
|
|
|
1558
1762
|
TODOs, linter directives and `@ts-expect-error` without a tracker.
|
|
@@ -1593,6 +1797,7 @@ Remove the need for the directive. If it must stay, add a tracked reference to t
|
|
|
1593
1797
|
|
|
1594
1798
|
### explicit-any
|
|
1595
1799
|
|
|
1800
|
+
- **Engines:** `eslint`
|
|
1596
1801
|
- **Settings traced to:** none.
|
|
1597
1802
|
|
|
1598
1803
|
An `any` type anywhere in a type position.
|
|
@@ -1604,6 +1809,7 @@ Needs ESLint adopted through the projection.
|
|
|
1604
1809
|
|
|
1605
1810
|
### implicit-any-let
|
|
1606
1811
|
|
|
1812
|
+
- **Engines:** `eslint`
|
|
1607
1813
|
- **Settings traced to:** none.
|
|
1608
1814
|
|
|
1609
1815
|
A `let` or `var` with neither a type annotation nor an initialiser.
|
|
@@ -1613,10 +1819,21 @@ Needs ESLint adopted through the projection.
|
|
|
1613
1819
|
- Under ESLint, this flags a `let` or `var` declaration in a `.ts` or `.tsx` file that has neither a type annotation nor an initialiser, one report per declaration at its first such binding. Declaration files (`.d.ts`), `const`, and `for-in` and `for-of` heads are not flagged.
|
|
1614
1820
|
- Allowed: `unknown`, `let total = 0` and `let total: number`.
|
|
1615
1821
|
|
|
1822
|
+
## Wide input
|
|
1823
|
+
|
|
1824
|
+
### unread-parameter
|
|
1825
|
+
|
|
1826
|
+
- **Engines:** `eslint`
|
|
1827
|
+
- **Misses:** Leading unread parameters before a read parameter or a constructor parameter property. Functions that read arguments, unread parameter properties and fields of objects left whole. Setter parameters are required by the language.
|
|
1828
|
+
- **Settings traced to:** None.
|
|
1829
|
+
|
|
1830
|
+
The signature demands a parameter or destructured field the unit never reads. Callers build and pass input that changes nothing.
|
|
1831
|
+
|
|
1616
1832
|
## Work inside a condition
|
|
1617
1833
|
|
|
1618
1834
|
### else-after-an-exit
|
|
1619
1835
|
|
|
1836
|
+
- **Engines:** `eslint`
|
|
1620
1837
|
- **Misses:** an `if` nested with no `else`.
|
|
1621
1838
|
- **Settings traced to:** none.
|
|
1622
1839
|
|
|
@@ -1656,6 +1873,7 @@ Handle the unhappy path first with an early return and leave the happy path as t
|
|
|
1656
1873
|
|
|
1657
1874
|
### parameter-mutation
|
|
1658
1875
|
|
|
1876
|
+
- **Engines:** `walker`
|
|
1659
1877
|
- **Settings traced to:** none.
|
|
1660
1878
|
|
|
1661
1879
|
Assignment to, deletion from or in-place methods on a parameter's fields.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# random-call
|
|
2
|
+
|
|
3
|
+
```json
|
|
4
|
+
{
|
|
5
|
+
"misses": "Local variable aliases, self.crypto, and crypto obtained through ordinary require calls or dynamic imports.",
|
|
6
|
+
"settingsTracedTo": "None."
|
|
7
|
+
}
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Direct calls to `Math.random`, `crypto.randomUUID` and `crypto.getRandomValues`. The check follows `globalThis.crypto`, `window.crypto` and static Node crypto imports, including `import = require` and access through a module’s `webcrypto` export. Locally bound receivers from other sources pass.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# assertion-site
|
|
2
|
+
|
|
3
|
+
```json
|
|
4
|
+
{
|
|
5
|
+
"misses": "Assertions called through another wrapper or a Vitest namespace import. A test registered through a shared fixture module or a mutable alias may be reported as outside a test. Asymmetric matchers and extension registration do not assert.",
|
|
6
|
+
"settingsTracedTo": "None."
|
|
7
|
+
}
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
An assertion in a hook, suite body or helper is detached from the test whose result it should determine. Put it in the case that exercises the behavior.
|