@hailstails/hone 2.0.0-pre.4 → 2.0.0-pre.6

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.
Files changed (135) hide show
  1. package/ADOPTING.md +10 -19
  2. package/CHANGELOG.md +46 -0
  3. package/MIGRATING.md +25 -14
  4. package/README.md +3 -4
  5. package/chunks/chunk-2U5EKYGS.js +14348 -0
  6. package/chunks/{chunk-FPIP7JEC.js → chunk-4AJQHZ7I.js} +1 -1
  7. package/chunks/chunk-4PHKVNM3.js +2377 -0
  8. package/chunks/{chunk-CXM5KBZX.js → chunk-6LTJRJOE.js} +1 -1
  9. package/chunks/{chunk-PVSC4SE3.js → chunk-BISP2JOL.js} +4 -6
  10. package/chunks/{chunk-BRANVR7K.js → chunk-FRE5IA3C.js} +1 -1
  11. package/chunks/{chunk-E4D5WDRX.js → chunk-GMLT3MHO.js} +252 -254
  12. package/chunks/chunk-M4VSJ27S.js +139 -0
  13. package/chunks/{chunk-YGMO5Z6U.js → chunk-P2VHWLK4.js} +182 -193
  14. package/chunks/{chunk-LD766VWU.js → chunk-U6W65ZOF.js} +31 -2
  15. package/chunks/{chunk-BKQ3K766.js → chunk-WPEOCLTP.js} +39 -33
  16. package/chunks/{chunk-A3RL4O5V.js → chunk-XNIXPQQ5.js} +35 -2
  17. package/docs/extending.md +2 -2
  18. package/methods/lenses/function-first.md +2 -2
  19. package/package.json +1 -1
  20. package/rules/README.md +5 -3
  21. package/rules/SPIRIT.md +1 -1
  22. package/rules/numbers.md +4 -4
  23. package/rules/principles/no-leak-across-a-boundary.md +1 -1
  24. package/rules/principles.md +1 -1
  25. package/rules/record-kinds/authorised-location.md +1 -1
  26. package/rules/records.md +11 -19
  27. package/rules/rules.md +5 -5
  28. package/rules/sources.md +6 -7
  29. package/rules/typescript/checks.md +55 -387
  30. package/rules/typescript/recipes/adapter-per-outside-party.md +10 -5
  31. package/rules/typescript/recipes/assert-to-narrow.md +114 -4
  32. package/rules/typescript/recipes/closure-factory.md +5 -5
  33. package/rules/typescript/recipes/companion-test-file.md +5 -3
  34. package/rules/typescript/recipes/composed-orchestrator.md +6 -4
  35. package/rules/typescript/recipes/composition-root.md +5 -3
  36. package/rules/typescript/recipes/{bounded-context-generic.md → constrained-context-generic.md} +6 -4
  37. package/rules/typescript/recipes/copy-never-write-in.md +6 -4
  38. package/rules/typescript/recipes/declared-not-bundled.md +5 -3
  39. package/rules/typescript/recipes/dependency-record.md +5 -3
  40. package/rules/typescript/recipes/domain-vocabulary-list.md +5 -3
  41. package/rules/typescript/recipes/entity-module.md +8 -5
  42. package/rules/typescript/recipes/exact-pins-and-a-lock-file.md +5 -3
  43. package/rules/typescript/recipes/extension-outside-the-vendored-code.md +5 -3
  44. package/rules/typescript/recipes/failure-asserted-as-a-value.md +44 -4
  45. package/rules/typescript/recipes/failure-mapping-at-the-adapter.md +8 -5
  46. package/rules/typescript/recipes/fix-the-declaration-not-the-value.md +5 -3
  47. package/rules/typescript/recipes/functional-iteration.md +8 -3
  48. package/rules/typescript/recipes/guard-clauses.md +5 -3
  49. package/rules/typescript/recipes/integration-test-owns-its-scratch.md +5 -3
  50. package/rules/typescript/recipes/integration-test-suffix.md +5 -3
  51. package/rules/typescript/recipes/it-each-over-typed-rows.md +117 -0
  52. package/rules/typescript/recipes/map-out-at-the-adapter.md +36 -4
  53. package/rules/typescript/recipes/meaning-in-names-not-comments.md +5 -5
  54. package/rules/typescript/recipes/named-exported-type.md +5 -3
  55. package/rules/typescript/recipes/narrow-ports.md +5 -3
  56. package/rules/typescript/recipes/one-argument-object.md +8 -3
  57. package/rules/typescript/recipes/{port-in-the-domain.md → port-in-a-module-of-its-own.md} +7 -5
  58. package/rules/typescript/recipes/ports-in-the-argument.md +5 -3
  59. package/rules/typescript/recipes/repo-scripts-only.md +5 -3
  60. package/rules/typescript/recipes/result-union.md +5 -5
  61. package/rules/typescript/recipes/screaming-folders.md +5 -5
  62. package/rules/typescript/recipes/shared-strict-base-config.md +5 -5
  63. package/rules/typescript/recipes/stub-with-vi-fn.md +130 -0
  64. package/rules/typescript/recipes/tagged-union-and-exhaustive-switch.md +5 -3
  65. package/rules/typescript/recipes/whole-words.md +5 -3
  66. package/rules/typescript/recipes/whole-written-out-expectation.md +284 -4
  67. package/rules/typescript/recipes/world-values-through-a-port.md +5 -3
  68. package/rules/typescript/recipes/zod-at-the-producers-adapter.md +8 -3
  69. package/rules/typescript/recipes.md +567 -21
  70. package/rules/typescript/symptoms/ambient-randomness.md +1 -1
  71. package/rules/typescript/symptoms/answer-set-in-a-hook.md +1 -1
  72. package/rules/typescript/symptoms/{assertion-outside-a-test → assertion-outside-a-test-body}/assertion-site.md +1 -1
  73. package/rules/typescript/symptoms/{assertion-outside-a-test.md → assertion-outside-a-test-body.md} +1 -1
  74. package/rules/typescript/symptoms/branch-in-a-test/test-body.md +10 -184
  75. package/rules/typescript/symptoms/branch-in-a-test.md +11 -1
  76. package/rules/typescript/symptoms/claimed-type/non-null-assertions.md +1 -1
  77. package/rules/typescript/symptoms/{code-or-prose-read-as-text.md → code-or-prose-read-as-text-in-a-test.md} +2 -2
  78. package/rules/typescript/symptoms/computed-value-in-a-test/test-body.md +26 -117
  79. package/rules/typescript/symptoms/computed-value-in-a-test.md +1 -1
  80. package/rules/typescript/symptoms/date-used-directly.md +1 -1
  81. package/rules/typescript/symptoms/default-for-a-required-value.md +1 -1
  82. package/rules/typescript/symptoms/double-with-a-body/logic-in-a-passed-function.md +1 -18
  83. package/rules/typescript/symptoms/double-with-a-body.md +1 -1
  84. package/rules/typescript/symptoms/{export-from-a-test-file.md → export-from-a-test.md} +1 -1
  85. package/rules/typescript/symptoms/failure-shaped-as-success.md +1 -1
  86. package/rules/typescript/symptoms/inherited-environment-in-a-subprocess/git-spawn-environment.md +1 -1
  87. package/rules/typescript/symptoms/inner-layer-imports-outer.md +1 -1
  88. package/rules/typescript/symptoms/library-class-built-in-place.md +1 -1
  89. package/rules/typescript/symptoms/loop-keyword/loop-statement.md +1 -1
  90. package/rules/typescript/symptoms/outside-import-past-a-boundary/import-or-require.md +1 -0
  91. package/rules/typescript/symptoms/outside-import-past-a-boundary.md +5 -4
  92. package/rules/typescript/symptoms/outside-type-in-a-signature.md +2 -2
  93. package/rules/typescript/symptoms/{port-outside-the-domain.md → port-beside-its-adapter.md} +2 -2
  94. package/rules/typescript/symptoms/port-named-for-a-mechanism.md +1 -1
  95. package/rules/typescript/symptoms/process-global-used-in-place.md +1 -1
  96. package/rules/typescript/symptoms/rebinding/test-body.md +1 -18
  97. package/rules/typescript/symptoms/rebinding.md +11 -1
  98. package/rules/typescript/symptoms/schema-past-its-adapter.md +2 -2
  99. package/rules/typescript/symptoms/text-past-its-reader/test-body.md +2 -17
  100. package/rules/typescript/symptoms/text-past-its-reader.md +1 -1
  101. package/rules/typescript/symptoms/throw-or-catch-in-a-test/try-block.md +1 -25
  102. package/rules/typescript/symptoms/type-declared-in-a-test/test-type-declaration.md +1 -1
  103. package/rules/typescript/symptoms/unasserted-call.md +1 -1
  104. package/rules/typescript/symptoms.md +35 -35
  105. package/src/application/conformance/conformance-testing-types.d.ts +2 -0
  106. package/src/domain/language-layer/authored-item-types.d.ts +21 -5
  107. package/src/domain/runner/runner-result-types.d.ts +1 -2
  108. package/src/eslint-plugin.js +40 -38
  109. package/src/hone.js +15 -13638
  110. package/src/infrastructure/disciplines-file/version-one-names.json +4 -5
  111. package/src/infrastructure/engines/eslint/runner/runner.js +56 -70
  112. package/src/infrastructure/engines/walker/{assertion-outside-a-test → assertion-outside-a-test-body}/assertion-site/assertion-site.js +1 -1
  113. package/src/infrastructure/engines/walker/branch-in-a-test/test-body/test-body-logic.js +39 -65
  114. package/src/infrastructure/engines/walker/{code-or-prose-read-as-text → code-or-prose-read-as-text-in-a-test}/raw-read/raw-read.js +1 -1
  115. package/src/infrastructure/engines/walker/{export-from-a-test-file → export-from-a-test}/test-file-export/test-file-export.js +1 -1
  116. package/src/infrastructure/engines/walker/runner/runner.js +10 -10
  117. package/src/infrastructure/engines/walker/strictness-weakened/strict/compiler-overrides.js +3 -3
  118. package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.examples.json +15 -3
  119. package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.js +118 -4
  120. package/src/measure-engines.process.js +80 -0
  121. package/src/testing.d.ts +1 -0
  122. package/src/testing.js +111 -26
  123. package/chunks/chunk-7FVSZ2VL.js +0 -1304
  124. package/chunks/chunk-BIDD2YWP.js +0 -398
  125. package/rules/record-kinds/boundary-record.md +0 -9
  126. package/rules/typescript/recipes/iteach-over-typed-rows.md +0 -18
  127. package/rules/typescript/recipes/stub-with-vifn.md +0 -20
  128. /package/rules/typescript/symptoms/{code-or-prose-read-as-text → code-or-prose-read-as-text-in-a-test}/raw-read.md +0 -0
  129. /package/rules/typescript/symptoms/{export-from-a-test-file → export-from-a-test}/test-file-export.md +0 -0
  130. /package/src/infrastructure/engines/walker/{assertion-outside-a-test → assertion-outside-a-test-body}/assertion-site/assertion-site.examples.json +0 -0
  131. /package/src/infrastructure/engines/walker/{assertion-outside-a-test → assertion-outside-a-test-body}/assertion-site/piece.json +0 -0
  132. /package/src/infrastructure/engines/walker/{code-or-prose-read-as-text → code-or-prose-read-as-text-in-a-test}/raw-read/piece.json +0 -0
  133. /package/src/infrastructure/engines/walker/{code-or-prose-read-as-text → code-or-prose-read-as-text-in-a-test}/raw-read/raw-read.examples.json +0 -0
  134. /package/src/infrastructure/engines/walker/{export-from-a-test-file → export-from-a-test}/test-file-export/piece.json +0 -0
  135. /package/src/infrastructure/engines/walker/{export-from-a-test-file → export-from-a-test}/test-file-export/test-file-export.examples.json +0 -0
@@ -268,8 +268,8 @@
268
268
  "clause": "CD-12#repository-ports",
269
269
  "sight": {
270
270
  "kind": "method",
271
- "recipe": "port-in-the-domain",
272
- "outcomeSeenBy": ["port-outside-the-domain", "inner-layer-imports-outer"]
271
+ "recipe": "port-in-a-module-of-its-own",
272
+ "outcomeSeenBy": ["port-beside-its-adapter", "inner-layer-imports-outer"]
273
273
  },
274
274
  "checks": []
275
275
  },
@@ -359,7 +359,7 @@
359
359
  "sight": {
360
360
  "kind": "method",
361
361
  "recipe": "composition-root",
362
- "outcomeSeenBy": ["adapter-built-outside-the-root", "port-outside-the-domain"]
362
+ "outcomeSeenBy": ["adapter-built-outside-the-root", "port-beside-its-adapter"]
363
363
  },
364
364
  "checks": []
365
365
  },
@@ -367,7 +367,7 @@
367
367
  "clause": "CD-22#middleware-context",
368
368
  "sight": {
369
369
  "kind": "method",
370
- "recipe": "bounded-context-generic",
370
+ "recipe": "constrained-context-generic",
371
371
  "outcomeSeenBy": ["default-for-a-required-value"]
372
372
  },
373
373
  "checks": []
@@ -628,7 +628,6 @@
628
628
  ],
629
629
  "recordKinds": {
630
630
  "authorised-location": "authorised-location",
631
- "boundary-record": "authorised-location",
632
631
  "debt": "file-carve-out"
633
632
  }
634
633
  }
@@ -1,13 +1,6 @@
1
1
  import {
2
- VERSION_ONE_SETTINGS_FILE_NAME,
3
- absoluteWithin,
4
- answeredAt,
5
- answeredByPlaceOf,
6
- eslintConfigLookupSchema,
7
- exclusionOf,
8
- projectionOutputsOf,
9
- repoPathOf
10
- } from "../../../../../chunks/chunk-BIDD2YWP.js";
2
+ siteRule
3
+ } from "../../../../../chunks/chunk-VYBO2Q65.js";
11
4
  import {
12
5
  CHECKS_PLUGIN_NAMESPACE,
13
6
  ESLINT_MECHANISM,
@@ -26,20 +19,30 @@ import {
26
19
  reservedNamespace,
27
20
  ruleOptionsOf,
28
21
  runsOnEslint
29
- } from "../../../../../chunks/chunk-E4D5WDRX.js";
30
- import {
31
- qualifiedAddressOf,
32
- qualifiedCheckAddressOf
33
- } from "../../../../../chunks/chunk-LD766VWU.js";
34
- import {
35
- ownedNameText
36
- } from "../../../../../chunks/chunk-FPIP7JEC.js";
22
+ } from "../../../../../chunks/chunk-GMLT3MHO.js";
37
23
  import {
38
24
  toolchainBoundNamedChecksRunner
39
25
  } from "../../../../../chunks/chunk-FHVNKG5Q.js";
40
26
  import {
41
27
  installRootOfRunnerEntry
42
- } from "../../../../../chunks/chunk-CXM5KBZX.js";
28
+ } from "../../../../../chunks/chunk-6LTJRJOE.js";
29
+ import {
30
+ absoluteWithin,
31
+ answeredAt,
32
+ answeredByPlaceOf,
33
+ eslintConfigLookupSchema,
34
+ exclusionOf
35
+ } from "../../../../../chunks/chunk-M4VSJ27S.js";
36
+ import {
37
+ VERSION_ONE_SETTINGS_FILE_NAME,
38
+ projectionOutputsOf,
39
+ qualifiedAddressOf,
40
+ qualifiedCheckAddressOf,
41
+ repoPathOf
42
+ } from "../../../../../chunks/chunk-U6W65ZOF.js";
43
+ import {
44
+ ownedNameText
45
+ } from "../../../../../chunks/chunk-4AJQHZ7I.js";
43
46
  import {
44
47
  CUT_MARK,
45
48
  SNIPPET_LIMIT
@@ -60,16 +63,13 @@ import {
60
63
  parsedJson,
61
64
  repoPathSchema,
62
65
  sameClauseAddress
63
- } from "../../../../../chunks/chunk-BKQ3K766.js";
66
+ } from "../../../../../chunks/chunk-WPEOCLTP.js";
64
67
  import {
65
68
  gatheredOutcomes,
66
69
  listedOutcome
67
70
  } from "../../../../../chunks/chunk-YONPKP3C.js";
68
71
  import "../../../../../chunks/chunk-OO5KV7KN.js";
69
72
  import "../../../../../chunks/chunk-RANIXNWY.js";
70
- import {
71
- siteRule
72
- } from "../../../../../chunks/chunk-VYBO2Q65.js";
73
73
  import "../../../../../chunks/chunk-DGOLOS5A.js";
74
74
 
75
75
  // src/infrastructure/engines/eslint/runner/checks-runner/checks-runner.ts
@@ -1730,7 +1730,7 @@ var queriedFiles = (request) => Promise.all(
1730
1730
  })
1731
1731
  );
1732
1732
  var queriedFilesOf = (request) => queriedFiles({ ...request, location: { ...request.location, names: VERSION_TWO_NAMES } });
1733
- var answeredHolds = (request) => answeredAt({ byPlace: request.answeredByPlace, ...request.entry, file: request.file }) ? "holds" : "does-not-hold";
1733
+ var answeredHolds = (request) => answeredAt({ byPlace: request.answeredByPlace, ...request.entry, file: request.file });
1734
1734
  var answeredOff = (request) => {
1735
1735
  return request.queried.checked.every(
1736
1736
  (checked) => allOffIn({
@@ -2922,28 +2922,6 @@ var slicedProjectionWrites = (request) => {
2922
2922
  const plan = slicePlanOf(request);
2923
2923
  return plan.outcome === "failed" ? plan : appliedPlan({ ...request, plan: plan.value });
2924
2924
  };
2925
- var slicedProjectionCurrency = (request) => {
2926
- const states = request.projectionFiles.currentOf({
2927
- files: request.roots.map((root) => slicePathOf({ root }))
2928
- });
2929
- if (states.outcome === "failed") return states;
2930
- return gatheredOutcomes({
2931
- outcomes: request.roots.map((root) => {
2932
- const expected = rootPlan({ ...request, root });
2933
- if (expected.outcome === "failed") return expected;
2934
- const current = projectionStateAt({ states: states.value, file: expected.value.file });
2935
- return current.outcome === "failed" ? current : {
2936
- outcome: "ok",
2937
- value: [
2938
- {
2939
- file: expected.value.file,
2940
- state: projectionState({ current: current.value, generated: expected.value.text })
2941
- }
2942
- ]
2943
- };
2944
- })
2945
- });
2946
- };
2947
2925
 
2948
2926
  // src/infrastructure/engines/eslint/runner/embedded-runner/eslint-repository.ts
2949
2927
  var VERSION_ONE_SETTINGS_FILE = "disciplines.json";
@@ -3092,12 +3070,10 @@ var versionOneProjectionOver = (platform) => {
3092
3070
  inspect: async (request) => {
3093
3071
  const plan = projectionPlanOf({ request, ports });
3094
3072
  if (plan.outcome === "failed") return plan;
3095
- const files = slicedProjectionCurrency(plan.value);
3096
- if (files.outcome === "failed") return files;
3097
3073
  return {
3098
3074
  outcome: "ok",
3099
3075
  value: {
3100
- files: files.value,
3076
+ files: plan.value.roots.map((root) => slicePathOf({ root })),
3101
3077
  ruleIds: new Map(
3102
3078
  plan.value.clauses.map(({ address, ruleId }) => [
3103
3079
  clauseAddressText({ address }),
@@ -3111,33 +3087,43 @@ var versionOneProjectionOver = (platform) => {
3111
3087
  };
3112
3088
  };
3113
3089
 
3090
+ // src/infrastructure/engines/eslint/runner/eslint-runner-module.ts
3091
+ var eslintRunnerModuleOver = (request) => ({
3092
+ ...bindEslintChecksModule({
3093
+ runner: request.toolchain.then(
3094
+ (loaded) => loaded.outcome === "failed" ? loaded : {
3095
+ outcome: "ok",
3096
+ value: createChecksRunner({
3097
+ ...request.platform,
3098
+ eslint: createEslintPort({ toolchain: loaded.value })
3099
+ })
3100
+ }
3101
+ ),
3102
+ projectedKinds: ESLINT_PROJECTED_KINDS
3103
+ }),
3104
+ versionOneProjectionOver
3105
+ });
3106
+
3114
3107
  // src/infrastructure/engines/eslint/runner/runner.ts
3115
- var runner = loadEslintToolchain({
3116
- peers: defaultEslintToolchainPeers({
3117
- installRoot: installRootOfRunnerEntry({ entryFile: import.meta.filename }),
3118
- installForm: installFormOf({
3119
- moduleExtension: moduleExtensionOf({ moduleUrl: import.meta.url })
3120
- })
3121
- })
3122
- }).then(
3123
- (loaded) => loaded.outcome === "failed" ? loaded : {
3124
- outcome: "ok",
3125
- value: createChecksRunner({
3126
- fileText: createDefaultFileTextPort({}),
3127
- fileRemoval: createDefaultFileRemovalPort({}),
3128
- modules: createDefaultModuleLoaderPort({}),
3129
- path: createDefaultPathPort({}),
3130
- eslint: createEslintPort({ toolchain: loaded.value }),
3131
- moduleExtension: moduleExtensionOf({ moduleUrl: import.meta.url })
3108
+ var { namedChecksRunner, measureVersionOne, versionOneProjectionOver: versionOneProjectionOver2 } = eslintRunnerModuleOver({
3109
+ toolchain: loadEslintToolchain({
3110
+ peers: defaultEslintToolchainPeers({
3111
+ installRoot: installRootOfRunnerEntry({ entryFile: import.meta.filename }),
3112
+ installForm: installFormOf({
3113
+ moduleExtension: moduleExtensionOf({ moduleUrl: import.meta.url })
3114
+ })
3132
3115
  })
3116
+ }),
3117
+ platform: {
3118
+ fileText: createDefaultFileTextPort({}),
3119
+ fileRemoval: createDefaultFileRemovalPort({}),
3120
+ modules: createDefaultModuleLoaderPort({}),
3121
+ path: createDefaultPathPort({}),
3122
+ moduleExtension: moduleExtensionOf({ moduleUrl: import.meta.url })
3133
3123
  }
3134
- );
3135
- var { namedChecksRunner, measureVersionOne } = bindEslintChecksModule({
3136
- runner,
3137
- projectedKinds: ESLINT_PROJECTED_KINDS
3138
3124
  });
3139
3125
  export {
3140
3126
  measureVersionOne,
3141
3127
  namedChecksRunner,
3142
- versionOneProjectionOver
3128
+ versionOneProjectionOver2 as versionOneProjectionOver
3143
3129
  };
@@ -19,7 +19,7 @@ import {
19
19
  } from "../../../../../../chunks/chunk-COQMPHWZ.js";
20
20
  import "../../../../../../chunks/chunk-DGOLOS5A.js";
21
21
 
22
- // src/infrastructure/engines/walker/assertion-outside-a-test/assertion-site/assertion-site.ts
22
+ // src/infrastructure/engines/walker/assertion-outside-a-test-body/assertion-site/assertion-site.ts
23
23
  var EXPECT_METHODS = /* @__PURE__ */ new Set(["soft", "poll", "assertions", "hasAssertions", "unreachable"]);
24
24
  var targetOf = ({ syntaxApi, node }) => {
25
25
  if (!syntaxApi.isCallExpression(node)) return void 0;
@@ -1,12 +1,12 @@
1
+ import {
2
+ editionOf
3
+ } from "../../../../../../chunks/chunk-RFR3ITBS.js";
1
4
  import {
2
5
  PACKAGE_MANIFEST
3
6
  } from "../../../../../../chunks/chunk-SKDQ3QJD.js";
4
7
  import {
5
8
  createDefaultJsoncParsePort
6
9
  } from "../../../../../../chunks/chunk-DJMF6JIM.js";
7
- import {
8
- editionOf
9
- } from "../../../../../../chunks/chunk-RFR3ITBS.js";
10
10
  import {
11
11
  sourceSnippetAt
12
12
  } from "../../../../../../chunks/chunk-5AKHEW6V.js";
@@ -43,113 +43,87 @@ var moduleOriginOf = (request) => {
43
43
 
44
44
  // src/infrastructure/engines/walker/branch-in-a-test/test-body/test-body-logic.ts
45
45
  var SECOND_EDITION = editionOf("2");
46
- var BRANCH_IN_A_TEST = "branch-in-a-test/test-body.md";
47
- var COMPUTED_VALUE_IN_A_TEST = "computed-value-in-a-test/test-body.md";
48
- var REBINDING = "rebinding/test-body.md";
49
- var TEXT_PAST_ITS_READER = "text-past-its-reader/test-body.md";
50
- var THROW_OR_CATCH_IN_A_TEST = "throw-or-catch-in-a-test/try-block.md";
51
- var DOUBLE_WITH_A_BODY = "double-with-a-body/logic-in-a-passed-function.md";
52
46
  var firstEdition = (remedy) => ({ introducedIn: editionOf("1"), remedy });
53
47
  var secondEdition = (remedy) => ({ introducedIn: SECOND_EDITION, remedy });
54
48
  var BRANCHING = firstEdition({
55
49
  fix: "The test branches because the unit can return more than one shape. Give each outcome its own test or make the return type express the one outcome callers can rely on.",
56
- page: BRANCH_IN_A_TEST,
57
- section: "branching-with-if"
50
+ form: "branching-with-if"
58
51
  });
59
52
  var TRY_BLOCK = firstEdition({
60
- fix: "Catching inside the test can let it pass when no error occurs. Assert the failure the caller should observe, whether it is returned or thrown.",
61
- page: THROW_OR_CATCH_IN_A_TEST,
62
- section: "a-try-block"
53
+ fix: "Catching inside the test can let it pass when no error occurs. Assert the failure the unit returns. Where an adapter's caller relies on a throw, assert the throw.",
54
+ form: "a-try-block"
63
55
  });
64
56
  var TERNARY = firstEdition({
65
57
  fix: "The test chooses between values at runtime. State the expected value for each case so the assertion cannot adapt to the result.",
66
- page: BRANCH_IN_A_TEST,
67
- section: "a-ternary"
58
+ form: "a-ternary"
68
59
  });
69
60
  var LET = firstEdition({
70
61
  fix: "A reassigned local makes the test depend on hidden state. Keep the expected values fixed and assert the interaction you need to observe.",
71
- page: REBINDING,
72
- section: "a-let"
62
+ form: "a-let"
73
63
  });
74
64
  var PICKING_METHOD = firstEdition({
75
- fix: "Selecting an element can discard data the caller should see. Assert the relevant membership or structure of the returned collection directly.",
76
- page: COMPUTED_VALUE_IN_A_TEST,
77
- section: "a-method-that-picks-or-tests-an-element"
65
+ fix: "Selecting an element can discard data the caller should see. Assert the whole returned collection.",
66
+ form: "a-method-that-picks-or-tests-an-element"
78
67
  });
79
68
  var COMPUTING_METHOD = firstEdition({
80
- fix: "Computing the expectation can repeat the mistake in the implementation. Write the expected value or the relevant properties explicitly.",
81
- page: COMPUTED_VALUE_IN_A_TEST,
82
- section: "a-method-that-computes-a-value"
69
+ fix: "Computing the expectation can repeat the mistake in the implementation. Write the expected value out.",
70
+ form: "a-method-that-computes-a-value"
83
71
  });
84
72
  var MUTATING_METHOD = firstEdition({
85
73
  fix: "Mutating the expected collection obscures its final state. State the finished collection so the reader can see what should be returned.",
86
- page: COMPUTED_VALUE_IN_A_TEST,
87
- section: "a-method-that-mutates"
74
+ form: "a-method-that-mutates"
88
75
  });
89
76
  var SHORT_CIRCUIT = secondEdition({
90
77
  fix: "Short-circuiting lets the test skip a case when the unit returns an optional or falsy value. Make required output explicit in the unit's type or test each outcome separately.",
91
- page: BRANCH_IN_A_TEST,
92
- section: "a-short-circuit"
78
+ form: "a-short-circuit"
93
79
  });
94
80
  var INDEXED_OPTIONAL_CHAIN = secondEdition({
95
- fix: "Optional access hides whether the expected element exists. Assert that the collection contains the required element and its relevant contents.",
96
- page: BRANCH_IN_A_TEST,
97
- section: "an-optional-chain-after-an-index"
81
+ fix: "Optional access hides whether the expected element exists. Assert the whole collection, or assert that the element is defined and then read it.",
82
+ form: "an-optional-chain-after-an-index"
98
83
  });
99
84
  var MOCK_CALL_OPTIONAL_CHAIN = secondEdition({
100
85
  fix: "Optional access hides whether the dependency was called. Assert the expected call and its arguments.",
101
- page: BRANCH_IN_A_TEST,
102
- section: "an-optional-chain-on-a-mock-call"
86
+ form: "an-optional-chain-on-a-mock-call"
103
87
  });
104
88
  var MOCK_RESULT_OPTIONAL_CHAIN = secondEdition({
105
- fix: "Optional access hides whether the dependency returned a value. Assert the return from the expected call.",
106
- page: BRANCH_IN_A_TEST,
107
- section: "an-optional-chain-on-a-mock-result"
89
+ fix: "Optional access hides whether the dependency returned a value. Write out what the collaborator gives back, then check what the unit returns and the call it makes.",
90
+ form: "an-optional-chain-on-a-mock-result"
108
91
  });
109
92
  var PROPERTY_OPTIONAL_CHAIN = secondEdition({
110
93
  fix: "The returned object can omit a property the caller needs. Make that property required in the unit's return type or test its absence as a separate outcome.",
111
- page: BRANCH_IN_A_TEST,
112
- section: "an-optional-chain-on-a-property"
94
+ form: "an-optional-chain-on-a-property"
113
95
  });
114
96
  var OPTIONAL_CALL = secondEdition({
115
97
  fix: "The unit's output makes the function optional, so callers cannot count on being able to call it. Make the function required in the return type or test the absent case separately.",
116
- page: BRANCH_IN_A_TEST,
117
- section: "an-optional-call"
98
+ form: "an-optional-call"
118
99
  });
119
100
  var SWITCH = secondEdition({
120
101
  fix: "The test branches on a value and can omit assertions for unexpected cases. State the expected outcome for each case separately.",
121
- page: BRANCH_IN_A_TEST,
122
- section: "a-switch"
102
+ form: "a-switch"
123
103
  });
124
104
  var JSON_CALL = secondEdition({
125
105
  fix: "Serializing or parsing inside the test can obscure the returned structure. Assert the object the caller needs and leave its wire format to the boundary adapter.",
126
- page: TEXT_PAST_ITS_READER,
127
- section: "serialising-or-parsing-json"
106
+ form: "serialising-or-parsing-json"
128
107
  });
129
108
  var OBJECT_ASSIGN = secondEdition({
130
109
  fix: "Building the expected object by mutation obscures its final shape. State the fields the caller should see and make any copied fields explicit.",
131
- page: COMPUTED_VALUE_IN_A_TEST,
132
- section: "merging-objects"
110
+ form: "merging-objects"
133
111
  });
134
112
  var OBJECT_FROM_ENTRIES = secondEdition({
135
- fix: "Building the expected object from entries hides the shape the assertion promises. Write out the relevant fields and values.",
136
- page: COMPUTED_VALUE_IN_A_TEST,
137
- section: "building-an-object-from-entries"
113
+ fix: "Building the expected object from entries hides the shape the assertion promises. Write the whole object out.",
114
+ form: "building-an-object-from-entries"
138
115
  });
139
116
  var ARRAY_FROM = secondEdition({
140
- fix: "Generating the expected array hides the sequence being asserted. State the relevant elements, length, or ordering directly.",
141
- page: COMPUTED_VALUE_IN_A_TEST,
142
- section: "building-an-array-from-a-length"
117
+ fix: "Generating the expected array hides the sequence being asserted. Write the array out.",
118
+ form: "building-an-array-from-a-length"
143
119
  });
144
120
  var MATH_CALL = secondEdition({
145
121
  fix: "Calculating the expected number can reproduce the implementation's error. State the expected number directly.",
146
- page: COMPUTED_VALUE_IN_A_TEST,
147
- section: "a-math-call"
122
+ form: "a-math-call"
148
123
  });
149
124
  var PASSED_ON_FUNCTION = {
150
125
  fix: "A callback with its own logic makes the test depend on a second implementation. Give the collaborator a fixed answer and assert how it was used.",
151
- page: DOUBLE_WITH_A_BODY,
152
- section: "logic-inside-a-function-the-test-passes-on"
126
+ form: "logic-inside-a-function-the-test-passes-on"
153
127
  };
154
128
  var FORMS_IN_PAGE_ORDER = [
155
129
  BRANCHING,
@@ -176,8 +150,8 @@ var TEST_BODY_REMEDIES = [
176
150
  ...FORMS_IN_PAGE_ORDER.map((form) => form.remedy),
177
151
  PASSED_ON_FUNCTION
178
152
  ];
179
- var TEST_BODY_SECTIONS = TEST_BODY_REMEDIES.map(
180
- (remedy) => remedy.section
153
+ var TEST_BODY_FORMS = TEST_BODY_REMEDIES.map(
154
+ (remedy) => remedy.form
181
155
  );
182
156
  var PICKING_METHODS = [
183
157
  "at",
@@ -646,22 +620,22 @@ var enclosingFunctionOf = (request) => {
646
620
  if (request.syntaxApi.isFunctionLike(request.node)) return request.node;
647
621
  return enclosingFunctionOf({ syntaxApi: request.syntaxApi, node: request.node.parent });
648
622
  };
649
- var directCallbackIsPassedOn = (request) => {
623
+ var findDirectCallbackEnclosure = (request) => {
650
624
  const { syntaxApi, node } = request;
651
625
  if (!syntaxApi.isCallExpression(node) || !syntaxApi.isIdentifier(node.expression) || TEST_REGISTRATION.has(node.expression.text)) {
652
- return false;
626
+ return "elsewhere";
653
627
  }
654
628
  const enclosing = enclosingFunctionOf({ syntaxApi, node: node.parent });
655
- if (enclosing === void 0) return true;
629
+ if (enclosing === void 0) return "passed-on-function";
656
630
  const registration = enclosing.parent;
657
- return syntaxApi.isCallExpression(registration) && syntaxApi.isIdentifier(registration.expression) && TEST_REGISTRATION.has(registration.expression.text);
631
+ return syntaxApi.isCallExpression(registration) && syntaxApi.isIdentifier(registration.expression) && TEST_REGISTRATION.has(registration.expression.text) ? "passed-on-function" : "elsewhere";
658
632
  };
659
633
  var enclosureOf = (request) => {
660
634
  const { syntaxApi } = request;
661
635
  const enclosing = enclosingFunctionOf({ syntaxApi, node: request.node.parent });
662
636
  if (enclosing === void 0) return "elsewhere";
663
637
  const holder = syntaxApi.isPropertyAssignment(enclosing.parent) ? enclosing.parent.parent : enclosing.parent;
664
- const passedOn = syntaxApi.isObjectLiteralExpression(holder) || takesImplementation({ syntaxApi, node: holder }) === "takes" || directCallbackIsPassedOn({ syntaxApi, node: holder });
638
+ const passedOn = syntaxApi.isObjectLiteralExpression(holder) || takesImplementation({ syntaxApi, node: holder }) === "takes" || findDirectCallbackEnclosure({ syntaxApi, node: holder }) === "passed-on-function";
665
639
  return passedOn ? "passed-on-function" : "elsewhere";
666
640
  };
667
641
  var testBodyFormOf = (request) => {
@@ -696,7 +670,7 @@ var check = {
696
670
  });
697
671
  if (form === void 0) return;
698
672
  const binding = bindings.find(
699
- ({ address, forms, edition }) => forms?.[form.remedy.section] === address && editionReaches({ edition, introducedIn: form.introducedIn }) === "reached"
673
+ ({ address, forms, edition }) => forms?.[form.remedy.form] === address && editionReaches({ edition, introducedIn: form.introducedIn }) === "reached"
700
674
  );
701
675
  if (binding === void 0) return;
702
676
  const position = node.getStart(sourceFile);
@@ -716,8 +690,8 @@ var check = {
716
690
  }
717
691
  };
718
692
  export {
693
+ TEST_BODY_FORMS,
719
694
  TEST_BODY_REMEDIES,
720
- TEST_BODY_SECTIONS,
721
695
  check,
722
696
  declarationsOf,
723
697
  testBodyFormOf
@@ -13,7 +13,7 @@ import {
13
13
  } from "../../../../../../chunks/chunk-COQMPHWZ.js";
14
14
  import "../../../../../../chunks/chunk-DGOLOS5A.js";
15
15
 
16
- // src/infrastructure/engines/walker/code-or-prose-read-as-text/raw-read/raw-read.ts
16
+ // src/infrastructure/engines/walker/code-or-prose-read-as-text-in-a-test/raw-read/raw-read.ts
17
17
  var TEXT_TYPES = /* @__PURE__ */ new Set(["ts", "tsx", "mts", "cts", "md", "mdx"]);
18
18
  var PATH_BUILDERS = /* @__PURE__ */ new Set(["join", "resolve", "normalize", "fileURLToPath"]);
19
19
  var FILE_READS = /* @__PURE__ */ new Set(["readFile", "readFileSync"]);
@@ -7,7 +7,7 @@ import {
7
7
  } from "../../../../../../chunks/chunk-COQMPHWZ.js";
8
8
  import "../../../../../../chunks/chunk-DGOLOS5A.js";
9
9
 
10
- // src/infrastructure/engines/walker/export-from-a-test-file/test-file-export/test-file-export.ts
10
+ // src/infrastructure/engines/walker/export-from-a-test/test-file-export/test-file-export.ts
11
11
  var exportAt = ({ syntaxApi, node, sourceFile }) => {
12
12
  if (node.parent !== sourceFile) return void 0;
13
13
  if (syntaxApi.isExportAssignment(node)) return node;
@@ -3,21 +3,21 @@ import {
3
3
  directiveEscapesIn,
4
4
  escapesOf
5
5
  } from "../../../../../chunks/chunk-MBEDAFVC.js";
6
- import {
7
- checkHitSchema,
8
- runnerResultSchema
9
- } from "../../../../../chunks/chunk-PVSC4SE3.js";
10
- import "../../../../../chunks/chunk-BRANVR7K.js";
11
- import {
12
- DEFAULT_TEST_FILES
13
- } from "../../../../../chunks/chunk-D6645WPB.js";
14
6
  import {
15
7
  toolchainBoundNamedChecksRunner
16
8
  } from "../../../../../chunks/chunk-FHVNKG5Q.js";
17
9
  import {
18
10
  createDefaultPackageLocationPort,
19
11
  installRootOfRunnerEntry
20
- } from "../../../../../chunks/chunk-CXM5KBZX.js";
12
+ } from "../../../../../chunks/chunk-6LTJRJOE.js";
13
+ import {
14
+ checkHitSchema,
15
+ runnerResultSchema
16
+ } from "../../../../../chunks/chunk-BISP2JOL.js";
17
+ import "../../../../../chunks/chunk-FRE5IA3C.js";
18
+ import {
19
+ DEFAULT_TEST_FILES
20
+ } from "../../../../../chunks/chunk-D6645WPB.js";
21
21
  import "../../../../../chunks/chunk-Z6JHBNDS.js";
22
22
  import {
23
23
  createDefaultEntryKindPort,
@@ -30,7 +30,7 @@ import {
30
30
  loadedPeer,
31
31
  moduleExtensionOf,
32
32
  moduleFileForm
33
- } from "../../../../../chunks/chunk-BKQ3K766.js";
33
+ } from "../../../../../chunks/chunk-WPEOCLTP.js";
34
34
  import {
35
35
  gatheredOutcomes
36
36
  } from "../../../../../chunks/chunk-YONPKP3C.js";
@@ -1,9 +1,9 @@
1
- import {
2
- createDefaultJsoncParsePort
3
- } from "../../../../../../chunks/chunk-DJMF6JIM.js";
4
1
  import {
5
2
  editionOf
6
3
  } from "../../../../../../chunks/chunk-RFR3ITBS.js";
4
+ import {
5
+ createDefaultJsoncParsePort
6
+ } from "../../../../../../chunks/chunk-DJMF6JIM.js";
7
7
  import {
8
8
  folderScope
9
9
  } from "../../../../../../chunks/chunk-COQMPHWZ.js";
@@ -1,24 +1,36 @@
1
1
  {
2
2
  "flag": [
3
3
  {
4
- "name": "types defined inside a test file",
4
+ "name": "type alias, interface and enum declared in a test",
5
5
  "fileName": "src/order.test.ts",
6
6
  "source": "type Amount = number;\ninterface Item { amount: Amount }\nenum State { Written }",
7
7
  "expectedLines": [1, 2, 3]
8
+ },
9
+ {
10
+ "name": "row with a literal-type member",
11
+ "fileName": "src/order.test.ts",
12
+ "source": "import type { Amount } from \"./order.ts\";\ntype Row = { readonly amount: Amount; readonly state: \"written\" };\nit.each<Row>([])(\"writes $amount\", () => {});",
13
+ "expectedLines": [2]
8
14
  }
9
15
  ],
10
16
  "allow": [
11
17
  {
12
- "name": "types are imported from their owner",
18
+ "name": "type imported by name and used inline",
13
19
  "fileName": "src/order.test.ts",
14
20
  "source": "import type { Amount } from \"./order.ts\";\nconst input: Amount = 1;",
15
21
  "expectedLines": []
16
22
  },
17
23
  {
18
- "name": "inline type literal",
24
+ "name": "inline type literal in a satisfies clause",
19
25
  "fileName": "src/order.test.ts",
20
26
  "source": "const input = { amount: 1 } satisfies { amount: number };",
21
27
  "expectedLines": []
28
+ },
29
+ {
30
+ "name": "row of an imported type and a primitive",
31
+ "fileName": "src/order.test.ts",
32
+ "source": "import type { Amount } from \"./order.ts\";\ntype Row = { readonly amount: Amount; readonly label: string };\nit.each<Row>([])(\"writes $label\", () => {});",
33
+ "expectedLines": []
22
34
  }
23
35
  ]
24
36
  }