eslint-plugin-traceability 1.23.0 → 1.23.1

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 (246) hide show
  1. package/CHANGELOG.md +9 -3
  2. package/package.json +8 -8
  3. package/lib/tests/cli-error-handling.test.d.ts +0 -1
  4. package/lib/tests/cli-error-handling.test.js +0 -54
  5. package/lib/tests/config/eslint-config-validation.test.d.ts +0 -9
  6. package/lib/tests/config/eslint-config-validation.test.js +0 -101
  7. package/lib/tests/config/flat-config-presets-integration.test.d.ts +0 -1
  8. package/lib/tests/config/flat-config-presets-integration.test.js +0 -76
  9. package/lib/tests/config/require-story-annotation-config.test.d.ts +0 -10
  10. package/lib/tests/config/require-story-annotation-config.test.js +0 -26
  11. package/lib/tests/fixtures/stale/example.d.ts +0 -0
  12. package/lib/tests/fixtures/stale/example.js +0 -4
  13. package/lib/tests/fixtures/update/example.d.ts +0 -0
  14. package/lib/tests/fixtures/update/example.js +0 -4
  15. package/lib/tests/fixtures/valid-annotations/example.d.ts +0 -0
  16. package/lib/tests/fixtures/valid-annotations/example.js +0 -3
  17. package/lib/tests/integration/annotation-placement-inside-prettier.integration.test.d.ts +0 -1
  18. package/lib/tests/integration/annotation-placement-inside-prettier.integration.test.js +0 -133
  19. package/lib/tests/integration/catch-annotation-prettier.integration.test.d.ts +0 -1
  20. package/lib/tests/integration/catch-annotation-prettier.integration.test.js +0 -121
  21. package/lib/tests/integration/cli-integration.test.d.ts +0 -1
  22. package/lib/tests/integration/cli-integration.test.js +0 -96
  23. package/lib/tests/integration/else-if-annotation-prettier.integration.test.d.ts +0 -1
  24. package/lib/tests/integration/else-if-annotation-prettier.integration.test.js +0 -100
  25. package/lib/tests/integration/no-redundant-annotation.integration.test.d.ts +0 -1
  26. package/lib/tests/integration/no-redundant-annotation.integration.test.js +0 -129
  27. package/lib/tests/integration/prettier-test-helpers.d.ts +0 -9
  28. package/lib/tests/integration/prettier-test-helpers.js +0 -35
  29. package/lib/tests/integration/require-traceability-aliases.integration.test.d.ts +0 -1
  30. package/lib/tests/integration/require-traceability-aliases.integration.test.js +0 -152
  31. package/lib/tests/integration/require-traceability-test-callbacks.integration.test.d.ts +0 -1
  32. package/lib/tests/integration/require-traceability-test-callbacks.integration.test.js +0 -149
  33. package/lib/tests/maintenance/batch.test.d.ts +0 -1
  34. package/lib/tests/maintenance/batch.test.js +0 -80
  35. package/lib/tests/maintenance/cli.test.d.ts +0 -1
  36. package/lib/tests/maintenance/cli.test.js +0 -306
  37. package/lib/tests/maintenance/detect-isolated.test.d.ts +0 -1
  38. package/lib/tests/maintenance/detect-isolated.test.js +0 -187
  39. package/lib/tests/maintenance/detect.test.d.ts +0 -1
  40. package/lib/tests/maintenance/detect.test.js +0 -46
  41. package/lib/tests/maintenance/index.test.d.ts +0 -1
  42. package/lib/tests/maintenance/index.test.js +0 -26
  43. package/lib/tests/maintenance/report.test.d.ts +0 -1
  44. package/lib/tests/maintenance/report.test.js +0 -68
  45. package/lib/tests/maintenance/storyParser.test.d.ts +0 -8
  46. package/lib/tests/maintenance/storyParser.test.js +0 -505
  47. package/lib/tests/maintenance/update-isolated.test.d.ts +0 -1
  48. package/lib/tests/maintenance/update-isolated.test.js +0 -71
  49. package/lib/tests/maintenance/update.test.d.ts +0 -1
  50. package/lib/tests/maintenance/update.test.js +0 -27
  51. package/lib/tests/perf/maintenance-cli-large-workspace.test.d.ts +0 -1
  52. package/lib/tests/perf/maintenance-cli-large-workspace.test.js +0 -229
  53. package/lib/tests/perf/maintenance-large-workspace.test.d.ts +0 -1
  54. package/lib/tests/perf/maintenance-large-workspace.test.js +0 -169
  55. package/lib/tests/perf/require-branch-annotation-large-file.test.d.ts +0 -1
  56. package/lib/tests/perf/require-branch-annotation-large-file.test.js +0 -67
  57. package/lib/tests/perf/valid-annotation-format-large-file.test.d.ts +0 -1
  58. package/lib/tests/perf/valid-annotation-format-large-file.test.js +0 -75
  59. package/lib/tests/plugin-default-export-and-configs.test.d.ts +0 -1
  60. package/lib/tests/plugin-default-export-and-configs.test.js +0 -121
  61. package/lib/tests/plugin-setup-error.test.d.ts +0 -6
  62. package/lib/tests/plugin-setup-error.test.js +0 -38
  63. package/lib/tests/plugin-setup.test.d.ts +0 -1
  64. package/lib/tests/plugin-setup.test.js +0 -63
  65. package/lib/tests/rules/auto-fix-behavior-008.test.d.ts +0 -1
  66. package/lib/tests/rules/auto-fix-behavior-008.test.js +0 -285
  67. package/lib/tests/rules/error-reporting.test.d.ts +0 -1
  68. package/lib/tests/rules/error-reporting.test.js +0 -99
  69. package/lib/tests/rules/no-redundant-annotation.test.d.ts +0 -1
  70. package/lib/tests/rules/no-redundant-annotation.test.js +0 -163
  71. package/lib/tests/rules/prefer-implements-annotation.test.d.ts +0 -1
  72. package/lib/tests/rules/prefer-implements-annotation.test.js +0 -162
  73. package/lib/tests/rules/require-branch-annotation.test.d.ts +0 -1
  74. package/lib/tests/rules/require-branch-annotation.test.js +0 -593
  75. package/lib/tests/rules/require-req-annotation.test.d.ts +0 -1
  76. package/lib/tests/rules/require-req-annotation.test.js +0 -264
  77. package/lib/tests/rules/require-story-annotation.test.d.ts +0 -1
  78. package/lib/tests/rules/require-story-annotation.test.js +0 -376
  79. package/lib/tests/rules/require-story-core-edgecases.test.d.ts +0 -1
  80. package/lib/tests/rules/require-story-core-edgecases.test.js +0 -15
  81. package/lib/tests/rules/require-story-core.autofix.test.d.ts +0 -1
  82. package/lib/tests/rules/require-story-core.autofix.test.js +0 -66
  83. package/lib/tests/rules/require-story-core.test.d.ts +0 -1
  84. package/lib/tests/rules/require-story-core.test.js +0 -65
  85. package/lib/tests/rules/require-story-helpers-edgecases.test.d.ts +0 -7
  86. package/lib/tests/rules/require-story-helpers-edgecases.test.js +0 -80
  87. package/lib/tests/rules/require-story-helpers.test.d.ts +0 -1
  88. package/lib/tests/rules/require-story-helpers.test.js +0 -474
  89. package/lib/tests/rules/require-story-io-behavior.test.d.ts +0 -7
  90. package/lib/tests/rules/require-story-io-behavior.test.js +0 -46
  91. package/lib/tests/rules/require-story-io.edgecases.test.d.ts +0 -7
  92. package/lib/tests/rules/require-story-io.edgecases.test.js +0 -46
  93. package/lib/tests/rules/require-story-utils.test.d.ts +0 -7
  94. package/lib/tests/rules/require-story-utils.test.js +0 -158
  95. package/lib/tests/rules/require-story-visitors-edgecases.test.d.ts +0 -7
  96. package/lib/tests/rules/require-story-visitors-edgecases.test.js +0 -27
  97. package/lib/tests/rules/require-test-traceability.test.d.ts +0 -1
  98. package/lib/tests/rules/require-test-traceability.test.js +0 -95
  99. package/lib/tests/rules/valid-annotation-format-internal.test.d.ts +0 -8
  100. package/lib/tests/rules/valid-annotation-format-internal.test.js +0 -47
  101. package/lib/tests/rules/valid-annotation-format.test.d.ts +0 -1
  102. package/lib/tests/rules/valid-annotation-format.test.js +0 -634
  103. package/lib/tests/rules/valid-req-reference.test.d.ts +0 -1
  104. package/lib/tests/rules/valid-req-reference.test.js +0 -129
  105. package/lib/tests/rules/valid-story-reference.test.d.ts +0 -1
  106. package/lib/tests/rules/valid-story-reference.test.js +0 -413
  107. package/lib/tests/utils/annotation-checker-autofix-behavior.test.d.ts +0 -5
  108. package/lib/tests/utils/annotation-checker-autofix-behavior.test.js +0 -103
  109. package/lib/tests/utils/annotation-checker.test.d.ts +0 -24
  110. package/lib/tests/utils/annotation-checker.test.js +0 -84
  111. package/lib/tests/utils/annotation-scope-analyzer.test.d.ts +0 -1
  112. package/lib/tests/utils/annotation-scope-analyzer.test.js +0 -211
  113. package/lib/tests/utils/branch-annotation-catch-insert-position.test.d.ts +0 -1
  114. package/lib/tests/utils/branch-annotation-catch-insert-position.test.js +0 -69
  115. package/lib/tests/utils/branch-annotation-catch-position.test.d.ts +0 -1
  116. package/lib/tests/utils/branch-annotation-catch-position.test.js +0 -115
  117. package/lib/tests/utils/branch-annotation-else-if-insert-position.test.d.ts +0 -1
  118. package/lib/tests/utils/branch-annotation-else-if-insert-position.test.js +0 -82
  119. package/lib/tests/utils/branch-annotation-else-if-position.test.d.ts +0 -1
  120. package/lib/tests/utils/branch-annotation-else-if-position.test.js +0 -145
  121. package/lib/tests/utils/branch-annotation-helpers.test.d.ts +0 -1
  122. package/lib/tests/utils/branch-annotation-helpers.test.js +0 -462
  123. package/lib/tests/utils/fsTestHelpers.d.ts +0 -7
  124. package/lib/tests/utils/fsTestHelpers.js +0 -26
  125. package/lib/tests/utils/ioTestHelpers.d.ts +0 -7
  126. package/lib/tests/utils/ioTestHelpers.js +0 -24
  127. package/lib/tests/utils/req-annotation-detection.test.d.ts +0 -1
  128. package/lib/tests/utils/req-annotation-detection.test.js +0 -358
  129. package/lib/tests/utils/require-story-core-test-helpers.d.ts +0 -10
  130. package/lib/tests/utils/require-story-core-test-helpers.js +0 -75
  131. package/lib/tests/utils/temp-dir-helpers.d.ts +0 -19
  132. package/lib/tests/utils/temp-dir-helpers.js +0 -62
  133. package/lib/tests/utils/ts-language-options.d.ts +0 -16
  134. package/lib/tests/utils/ts-language-options.js +0 -30
  135. /package/lib/{src/index.d.ts → index.d.ts} +0 -0
  136. /package/lib/{src/index.js → index.js} +0 -0
  137. /package/lib/{src/maintenance → maintenance}/batch.d.ts +0 -0
  138. /package/lib/{src/maintenance → maintenance}/batch.js +0 -0
  139. /package/lib/{src/maintenance → maintenance}/cli.d.ts +0 -0
  140. /package/lib/{src/maintenance → maintenance}/cli.js +0 -0
  141. /package/lib/{src/maintenance → maintenance}/commands.d.ts +0 -0
  142. /package/lib/{src/maintenance → maintenance}/commands.js +0 -0
  143. /package/lib/{src/maintenance → maintenance}/detect.d.ts +0 -0
  144. /package/lib/{src/maintenance → maintenance}/detect.js +0 -0
  145. /package/lib/{src/maintenance → maintenance}/flags.d.ts +0 -0
  146. /package/lib/{src/maintenance → maintenance}/flags.js +0 -0
  147. /package/lib/{src/maintenance → maintenance}/index.d.ts +0 -0
  148. /package/lib/{src/maintenance → maintenance}/index.js +0 -0
  149. /package/lib/{src/maintenance → maintenance}/report.d.ts +0 -0
  150. /package/lib/{src/maintenance → maintenance}/report.js +0 -0
  151. /package/lib/{src/maintenance → maintenance}/storyParser.d.ts +0 -0
  152. /package/lib/{src/maintenance → maintenance}/storyParser.js +0 -0
  153. /package/lib/{src/maintenance → maintenance}/update.d.ts +0 -0
  154. /package/lib/{src/maintenance → maintenance}/update.js +0 -0
  155. /package/lib/{src/maintenance → maintenance}/utils.d.ts +0 -0
  156. /package/lib/{src/maintenance → maintenance}/utils.js +0 -0
  157. /package/lib/{src/rules → rules}/helpers/pattern-validators.d.ts +0 -0
  158. /package/lib/{src/rules → rules}/helpers/pattern-validators.js +0 -0
  159. /package/lib/{src/rules → rules}/helpers/prefer-implements-inline.d.ts +0 -0
  160. /package/lib/{src/rules → rules}/helpers/prefer-implements-inline.js +0 -0
  161. /package/lib/{src/rules → rules}/helpers/require-story-comment-detection.d.ts +0 -0
  162. /package/lib/{src/rules → rules}/helpers/require-story-comment-detection.js +0 -0
  163. /package/lib/{src/rules → rules}/helpers/require-story-core.d.ts +0 -0
  164. /package/lib/{src/rules → rules}/helpers/require-story-core.js +0 -0
  165. /package/lib/{src/rules → rules}/helpers/require-story-helpers.d.ts +0 -0
  166. /package/lib/{src/rules → rules}/helpers/require-story-helpers.js +0 -0
  167. /package/lib/{src/rules → rules}/helpers/require-story-io.d.ts +0 -0
  168. /package/lib/{src/rules → rules}/helpers/require-story-io.js +0 -0
  169. /package/lib/{src/rules → rules}/helpers/require-story-name-extraction.d.ts +0 -0
  170. /package/lib/{src/rules → rules}/helpers/require-story-name-extraction.js +0 -0
  171. /package/lib/{src/rules → rules}/helpers/require-story-node-utils.d.ts +0 -0
  172. /package/lib/{src/rules → rules}/helpers/require-story-node-utils.js +0 -0
  173. /package/lib/{src/rules → rules}/helpers/require-story-utils.d.ts +0 -0
  174. /package/lib/{src/rules → rules}/helpers/require-story-utils.js +0 -0
  175. /package/lib/{src/rules → rules}/helpers/require-story-visitors.d.ts +0 -0
  176. /package/lib/{src/rules → rules}/helpers/require-story-visitors.js +0 -0
  177. /package/lib/{src/rules → rules}/helpers/require-test-traceability-helpers.d.ts +0 -0
  178. /package/lib/{src/rules → rules}/helpers/require-test-traceability-helpers.js +0 -0
  179. /package/lib/{src/rules → rules}/helpers/test-callback-exclusion.d.ts +0 -0
  180. /package/lib/{src/rules → rules}/helpers/test-callback-exclusion.js +0 -0
  181. /package/lib/{src/rules → rules}/helpers/valid-annotation-format-internal.d.ts +0 -0
  182. /package/lib/{src/rules → rules}/helpers/valid-annotation-format-internal.js +0 -0
  183. /package/lib/{src/rules → rules}/helpers/valid-annotation-format-validators.d.ts +0 -0
  184. /package/lib/{src/rules → rules}/helpers/valid-annotation-format-validators.js +0 -0
  185. /package/lib/{src/rules → rules}/helpers/valid-annotation-options.d.ts +0 -0
  186. /package/lib/{src/rules → rules}/helpers/valid-annotation-options.js +0 -0
  187. /package/lib/{src/rules → rules}/helpers/valid-annotation-utils.d.ts +0 -0
  188. /package/lib/{src/rules → rules}/helpers/valid-annotation-utils.js +0 -0
  189. /package/lib/{src/rules → rules}/helpers/valid-implements-utils.d.ts +0 -0
  190. /package/lib/{src/rules → rules}/helpers/valid-implements-utils.js +0 -0
  191. /package/lib/{src/rules → rules}/helpers/valid-req-reference-helpers.d.ts +0 -0
  192. /package/lib/{src/rules → rules}/helpers/valid-req-reference-helpers.js +0 -0
  193. /package/lib/{src/rules → rules}/helpers/valid-story-reference-helpers.d.ts +0 -0
  194. /package/lib/{src/rules → rules}/helpers/valid-story-reference-helpers.js +0 -0
  195. /package/lib/{src/rules → rules}/no-redundant-annotation.d.ts +0 -0
  196. /package/lib/{src/rules → rules}/no-redundant-annotation.js +0 -0
  197. /package/lib/{src/rules → rules}/prefer-implements-annotation.d.ts +0 -0
  198. /package/lib/{src/rules → rules}/prefer-implements-annotation.js +0 -0
  199. /package/lib/{src/rules → rules}/require-branch-annotation.d.ts +0 -0
  200. /package/lib/{src/rules → rules}/require-branch-annotation.js +0 -0
  201. /package/lib/{src/rules → rules}/require-req-annotation.d.ts +0 -0
  202. /package/lib/{src/rules → rules}/require-req-annotation.js +0 -0
  203. /package/lib/{src/rules → rules}/require-story-annotation.d.ts +0 -0
  204. /package/lib/{src/rules → rules}/require-story-annotation.js +0 -0
  205. /package/lib/{src/rules → rules}/require-test-traceability.d.ts +0 -0
  206. /package/lib/{src/rules → rules}/require-test-traceability.js +0 -0
  207. /package/lib/{src/rules → rules}/require-traceability.d.ts +0 -0
  208. /package/lib/{src/rules → rules}/require-traceability.js +0 -0
  209. /package/lib/{src/rules → rules}/valid-annotation-format.d.ts +0 -0
  210. /package/lib/{src/rules → rules}/valid-annotation-format.js +0 -0
  211. /package/lib/{src/rules → rules}/valid-req-reference.d.ts +0 -0
  212. /package/lib/{src/rules → rules}/valid-req-reference.js +0 -0
  213. /package/lib/{src/rules → rules}/valid-story-reference.d.ts +0 -0
  214. /package/lib/{src/rules → rules}/valid-story-reference.js +0 -0
  215. /package/lib/{src/utils → utils}/annotation-checker.d.ts +0 -0
  216. /package/lib/{src/utils → utils}/annotation-checker.js +0 -0
  217. /package/lib/{src/utils → utils}/annotation-scope-analyzer.d.ts +0 -0
  218. /package/lib/{src/utils → utils}/annotation-scope-analyzer.js +0 -0
  219. /package/lib/{src/utils → utils}/branch-annotation-catch-helpers.d.ts +0 -0
  220. /package/lib/{src/utils → utils}/branch-annotation-catch-helpers.js +0 -0
  221. /package/lib/{src/utils → utils}/branch-annotation-helpers.d.ts +0 -0
  222. /package/lib/{src/utils → utils}/branch-annotation-helpers.js +0 -0
  223. /package/lib/{src/utils → utils}/branch-annotation-if-helpers.d.ts +0 -0
  224. /package/lib/{src/utils → utils}/branch-annotation-if-helpers.js +0 -0
  225. /package/lib/{src/utils → utils}/branch-annotation-indent-helpers.d.ts +0 -0
  226. /package/lib/{src/utils → utils}/branch-annotation-indent-helpers.js +0 -0
  227. /package/lib/{src/utils → utils}/branch-annotation-loop-helpers.d.ts +0 -0
  228. /package/lib/{src/utils → utils}/branch-annotation-loop-helpers.js +0 -0
  229. /package/lib/{src/utils → utils}/branch-annotation-report-helpers.d.ts +0 -0
  230. /package/lib/{src/utils → utils}/branch-annotation-report-helpers.js +0 -0
  231. /package/lib/{src/utils → utils}/branch-annotation-story-fix-helpers.d.ts +0 -0
  232. /package/lib/{src/utils → utils}/branch-annotation-story-fix-helpers.js +0 -0
  233. /package/lib/{src/utils → utils}/branch-annotation-switch-helpers.d.ts +0 -0
  234. /package/lib/{src/utils → utils}/branch-annotation-switch-helpers.js +0 -0
  235. /package/lib/{src/utils → utils}/branch-validation.d.ts +0 -0
  236. /package/lib/{src/utils → utils}/branch-validation.js +0 -0
  237. /package/lib/{src/utils → utils}/comment-text-helpers.d.ts +0 -0
  238. /package/lib/{src/utils → utils}/comment-text-helpers.js +0 -0
  239. /package/lib/{src/utils → utils}/function-annotation-helpers.d.ts +0 -0
  240. /package/lib/{src/utils → utils}/function-annotation-helpers.js +0 -0
  241. /package/lib/{src/utils → utils}/redundancy-detector.d.ts +0 -0
  242. /package/lib/{src/utils → utils}/redundancy-detector.js +0 -0
  243. /package/lib/{src/utils → utils}/reqAnnotationDetection.d.ts +0 -0
  244. /package/lib/{src/utils → utils}/reqAnnotationDetection.js +0 -0
  245. /package/lib/{src/utils → utils}/storyReferenceUtils.d.ts +0 -0
  246. /package/lib/{src/utils → utils}/storyReferenceUtils.js +0 -0
@@ -1,149 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- /* eslint-disable traceability/valid-annotation-format */
7
- /**
8
- * Integration tests for require-traceability with configurable test callback exclusion.
9
- *
10
- * @supports docs/stories/010.4-DEV-UNIFIED-FUNCTION-RULE-AND-ALIASES.story.md REQ-UNIFIED-ALIAS-ENGINE
11
- * @supports docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md REQ-ANNOTATION-REQUIRED REQ-FUNCTION-DETECTION
12
- * @supports docs/stories/013-exclude-test-framework-callbacks.proposed.md REQ-TEST-CALLBACK-EXCLUSION
13
- */
14
- const use_at_your_own_risk_1 = require("eslint/use-at-your-own-risk");
15
- const index_1 = __importDefault(require("../../src/index"));
16
- async function lintTextWithConfig(text, filename, extraConfig) {
17
- const baseConfig = {
18
- plugins: {
19
- traceability: index_1.default,
20
- },
21
- };
22
- const eslint = new use_at_your_own_risk_1.FlatESLint({
23
- overrideConfig: [baseConfig, ...extraConfig],
24
- overrideConfigFile: true,
25
- ignore: false,
26
- });
27
- const [result] = await eslint.lintText(text, { filePath: filename });
28
- return result;
29
- }
30
- describe("Unified require-traceability with configurable test callback exclusion (Story 013-exclude-test-framework-callbacks)", () => {
31
- const baseHeader = `/**\n * @supports docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md REQ-ANNOTATION-REQUIRED\n */`;
32
- const jsTestCallback = `${baseHeader}\n
33
- describe('suite', () => {\n it('does something', () => {\n const value = 1;\n });\n});`;
34
- const tsTestCallback = `${baseHeader}\n
35
- import { describe, it } from 'vitest';
36
-
37
- describe('suite', () => {\n it('does something', () => {\n const value = 1;\n });\n});`;
38
- const jsBenchCallback = `${baseHeader}\n
39
- import { bench } from 'vitest';
40
-
41
- bench('bench case', () => {\n function helper() {}\n helper();\n});`;
42
- const jsCustomHelperCallback = `${baseHeader}\n
43
- function helperWrapper(fn) {\n return fn;\n}
44
-
45
- helperWrapper(() => {\n function helper() {}\n helper();\n});`;
46
- async function getRuleMessages(code, filename, extraConfig) {
47
- const result = await lintTextWithConfig(code, filename, extraConfig);
48
- return result.messages.filter((m) => m.ruleId === "traceability/require-traceability" ||
49
- m.ruleId === "traceability/require-story-annotation");
50
- }
51
- it("[REQ-TEST-CALLBACK-EXCLUSION] excludes callbacks under known test helpers when configured", async () => {
52
- const config = [
53
- {
54
- rules: {
55
- "traceability/require-traceability": ["error"],
56
- "traceability/require-story-annotation": [
57
- "error",
58
- {
59
- excludeTestCallbacks: true,
60
- },
61
- ],
62
- },
63
- },
64
- ];
65
- const messagesJs = await getRuleMessages(jsTestCallback, "example.test.js", config);
66
- const messagesTs = await getRuleMessages(tsTestCallback, "example.test.ts", config);
67
- expect(messagesJs).toHaveLength(0);
68
- expect(messagesTs).toHaveLength(0);
69
- });
70
- it("[REQ-TEST-CALLBACK-EXCLUSION] never excludes Vitest bench callbacks via test-callback exclusion, even when exclusion is enabled", async () => {
71
- const baseConfig = [
72
- {
73
- rules: {
74
- "traceability/require-traceability": ["error"],
75
- "traceability/require-story-annotation": [
76
- "error",
77
- {
78
- excludeTestCallbacks: true,
79
- },
80
- ],
81
- },
82
- },
83
- ];
84
- const withBenchAsHelperConfig = [
85
- {
86
- rules: {
87
- "traceability/require-traceability": ["error"],
88
- "traceability/require-story-annotation": [
89
- "error",
90
- {
91
- excludeTestCallbacks: true,
92
- additionalTestHelperNames: ["bench"],
93
- },
94
- ],
95
- },
96
- },
97
- ];
98
- const baseResult = await lintTextWithConfig(jsBenchCallback, "bench.test.ts", baseConfig);
99
- const withBenchHelperResult = await lintTextWithConfig(jsBenchCallback, "bench.test.ts", withBenchAsHelperConfig);
100
- const baseMessages = baseResult.messages.filter((m) => m.ruleId === "traceability/require-traceability" ||
101
- m.ruleId === "traceability/require-story-annotation");
102
- const withBenchHelperMessages = withBenchHelperResult.messages.filter((m) => m.ruleId === "traceability/require-traceability" ||
103
- m.ruleId === "traceability/require-story-annotation");
104
- expect(withBenchHelperMessages.length).toBeGreaterThanOrEqual(baseMessages.length);
105
- });
106
- it("[REQ-TEST-CALLBACK-EXCLUSION] respects additionalTestHelperNames for custom helpers but not for bench callbacks", async () => {
107
- const baseConfig = [
108
- {
109
- rules: {
110
- "traceability/require-traceability": ["error"],
111
- "traceability/require-story-annotation": [
112
- "error",
113
- {
114
- excludeTestCallbacks: true,
115
- },
116
- ],
117
- },
118
- },
119
- ];
120
- const withAdditionalHelpersConfig = [
121
- {
122
- rules: {
123
- "traceability/require-traceability": ["error"],
124
- "traceability/require-story-annotation": [
125
- "error",
126
- {
127
- excludeTestCallbacks: true,
128
- additionalTestHelperNames: ["helperWrapper", "bench"],
129
- },
130
- ],
131
- },
132
- },
133
- ];
134
- const wrapperBaseResult = await lintTextWithConfig(jsCustomHelperCallback, "helper-wrapper.test.ts", baseConfig);
135
- const wrapperWithHelpersResult = await lintTextWithConfig(jsCustomHelperCallback, "helper-wrapper.test.ts", withAdditionalHelpersConfig);
136
- const benchBaseResult = await lintTextWithConfig(jsBenchCallback, "bench.test.ts", baseConfig);
137
- const benchWithHelpersResult = await lintTextWithConfig(jsBenchCallback, "bench.test.ts", withAdditionalHelpersConfig);
138
- const wrapperBaseMessages = wrapperBaseResult.messages.filter((m) => m.ruleId === "traceability/require-traceability" ||
139
- m.ruleId === "traceability/require-story-annotation");
140
- const wrapperWithHelpersMessages = wrapperWithHelpersResult.messages.filter((m) => m.ruleId === "traceability/require-traceability" ||
141
- m.ruleId === "traceability/require-story-annotation");
142
- const benchBaseMessages = benchBaseResult.messages.filter((m) => m.ruleId === "traceability/require-traceability" ||
143
- m.ruleId === "traceability/require-story-annotation");
144
- const benchWithHelpersMessages = benchWithHelpersResult.messages.filter((m) => m.ruleId === "traceability/require-traceability" ||
145
- m.ruleId === "traceability/require-story-annotation");
146
- expect(wrapperWithHelpersMessages.length).toBeLessThanOrEqual(wrapperBaseMessages.length);
147
- expect(benchWithHelpersMessages.length).toBeGreaterThanOrEqual(benchBaseMessages.length);
148
- });
149
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,80 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- /**
37
- * Tests for: docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
38
- * @story docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
39
- * @req REQ-MAINT-BATCH - Perform batch updates
40
- * @req REQ-MAINT-VERIFY - Verify annotation references
41
- * @supports docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md REQ-MAINT-BATCH REQ-MAINT-VERIFY
42
- */
43
- const fs = __importStar(require("fs"));
44
- const path = __importStar(require("path"));
45
- const temp_dir_helpers_1 = require("../utils/temp-dir-helpers");
46
- const batch_1 = require("../../src/maintenance/batch");
47
- describe("batchUpdateAnnotations (Story 009.0-DEV-MAINTENANCE-TOOLS)", () => {
48
- let temp;
49
- beforeAll(() => {
50
- temp = (0, temp_dir_helpers_1.createTempDir)("batch-test-");
51
- });
52
- afterAll(() => {
53
- temp.cleanup();
54
- });
55
- it("[REQ-MAINT-BATCH] should return 0 when no mappings applied", () => {
56
- const count = (0, batch_1.batchUpdateAnnotations)(temp.dir, []);
57
- expect(count).toBe(0);
58
- });
59
- });
60
- describe("verifyAnnotations (Story 009.0-DEV-MAINTENANCE-TOOLS)", () => {
61
- let temp;
62
- beforeAll(() => {
63
- temp = (0, temp_dir_helpers_1.createTempDir)("verify-test-");
64
- const tsContent = `
65
- /**
66
- * Tests for: my-story.story.md
67
- * @story my-story.story.md
68
- */
69
- `;
70
- fs.writeFileSync(path.join(temp.dir, "test.ts"), tsContent);
71
- fs.writeFileSync(path.join(temp.dir, "my-story.story.md"), "# Dummy Story");
72
- });
73
- afterAll(() => {
74
- temp.cleanup();
75
- });
76
- it("[REQ-MAINT-VERIFY] should return true when annotations are valid", () => {
77
- const valid = (0, batch_1.verifyAnnotations)(temp.dir);
78
- expect(valid).toBe(true);
79
- });
80
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,306 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- /**
7
- * Tests for: docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
8
- * @story docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
9
- * @req REQ-MAINT-DETECT - CLI detection of stale annotations
10
- * @req REQ-MAINT-VERIFY - CLI verification of annotations
11
- * @req REQ-MAINT-REPORT - CLI reporting of stale annotations
12
- * @req REQ-MAINT-UPDATE - CLI updating of annotation references
13
- * @req REQ-MAINT-SAFE - Clear exit codes and non-destructive dry-run
14
- * @supports docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md REQ-MAINT-DETECT REQ-MAINT-VERIFY REQ-MAINT-REPORT REQ-MAINT-UPDATE REQ-MAINT-SAFE
15
- */
16
- const fs_1 = __importDefault(require("fs"));
17
- const path_1 = __importDefault(require("path"));
18
- const cli_1 = require("../../src/maintenance/cli");
19
- const temp_dir_helpers_1 = require("../utils/temp-dir-helpers");
20
- describe("Maintenance CLI (Story 009.0-DEV-MAINTENANCE-TOOLS)", () => {
21
- let originalCwd;
22
- beforeAll(() => {
23
- originalCwd = process.cwd();
24
- });
25
- afterAll(() => {
26
- process.chdir(originalCwd);
27
- });
28
- it("[REQ-MAINT-DETECT] detect exits with code 0 and message when no stale annotations", () => {
29
- const temp = (0, temp_dir_helpers_1.createTempDir)("maint-cli-");
30
- const dir = temp.dir;
31
- process.chdir(dir);
32
- const logSpy = jest.spyOn(console, "log").mockImplementation(() => { });
33
- const code = (0, cli_1.runMaintenanceCli)(["node", "traceability-maint", "detect"]);
34
- try {
35
- expect(code).toBe(0);
36
- expect(logSpy).toHaveBeenCalledWith("No stale @story annotations found.");
37
- }
38
- finally {
39
- logSpy.mockRestore();
40
- temp.cleanup();
41
- }
42
- });
43
- it("[REQ-MAINT-VERIFY] verify exits with code 0 when annotations valid", () => {
44
- const temp = (0, temp_dir_helpers_1.createTempDir)("maint-cli-");
45
- const dir = temp.dir;
46
- process.chdir(dir);
47
- const tsContent = `/**\n * @story my-story.story.md\n */`;
48
- fs_1.default.writeFileSync(path_1.default.join(dir, "file.ts"), tsContent, "utf8");
49
- fs_1.default.writeFileSync(path_1.default.join(dir, "my-story.story.md"), "# Dummy Story", "utf8");
50
- const logSpy = jest.spyOn(console, "log").mockImplementation(() => { });
51
- const code = (0, cli_1.runMaintenanceCli)(["node", "traceability-maint", "verify"]);
52
- try {
53
- expect(code).toBe(0);
54
- expect(logSpy).toHaveBeenCalledTimes(1);
55
- }
56
- finally {
57
- logSpy.mockRestore();
58
- temp.cleanup();
59
- }
60
- });
61
- it("[REQ-MAINT-VERIFY] verify exits with code 1 and prints guidance when annotations are stale or invalid", () => {
62
- const temp = (0, temp_dir_helpers_1.createTempDir)("maint-cli-");
63
- const dir = temp.dir;
64
- process.chdir(dir);
65
- const tsContent = `/**\n * @story missing.story.md\n */`;
66
- fs_1.default.writeFileSync(path_1.default.join(dir, "file.ts"), tsContent, "utf8");
67
- const logSpy = jest.spyOn(console, "log").mockImplementation(() => { });
68
- const code = (0, cli_1.runMaintenanceCli)(["node", "traceability-maint", "verify"]);
69
- try {
70
- expect(code).toBe(1);
71
- expect(logSpy).toHaveBeenCalledTimes(1);
72
- const message = String(logSpy.mock.calls[0][0]);
73
- expect(message).toContain("Stale or invalid traceability annotations detected under");
74
- expect(message).toContain("Run 'traceability-maint detect' or 'traceability-maint report' for details.");
75
- }
76
- finally {
77
- logSpy.mockRestore();
78
- temp.cleanup();
79
- }
80
- });
81
- it("[REQ-MAINT-REPORT] report prints human-readable summary and exits 0", () => {
82
- const temp = (0, temp_dir_helpers_1.createTempDir)("maint-cli-");
83
- const dir = temp.dir;
84
- process.chdir(dir);
85
- const tsContent = `/**\n * @story missing.story.md\n */`;
86
- fs_1.default.writeFileSync(path_1.default.join(dir, "file.ts"), tsContent, "utf8");
87
- const logSpy = jest.spyOn(console, "log").mockImplementation(() => { });
88
- const code = (0, cli_1.runMaintenanceCli)(["node", "traceability-maint", "report"]);
89
- try {
90
- expect(code).toBe(0);
91
- const allMessages = logSpy.mock.calls.flat().join("\n");
92
- expect(allMessages).toContain("Traceability Maintenance Report");
93
- expect(allMessages).toContain("missing.story.md");
94
- }
95
- finally {
96
- logSpy.mockRestore();
97
- temp.cleanup();
98
- }
99
- });
100
- it("[REQ-MAINT-REPORT] report prints 'nothing to report' when no stale annotations exist", () => {
101
- const temp = (0, temp_dir_helpers_1.createTempDir)("maint-cli-");
102
- const dir = temp.dir;
103
- process.chdir(dir);
104
- const logSpy = jest.spyOn(console, "log").mockImplementation(() => { });
105
- const code = (0, cli_1.runMaintenanceCli)(["node", "traceability-maint", "report"]);
106
- try {
107
- expect(code).toBe(0);
108
- expect(logSpy).toHaveBeenCalled();
109
- const allMessages = logSpy.mock.calls.flat().join("\n");
110
- expect(allMessages).toContain("No stale @story annotations found. Nothing to report.");
111
- }
112
- finally {
113
- logSpy.mockRestore();
114
- temp.cleanup();
115
- }
116
- });
117
- it("[REQ-MAINT-UPDATE] update performs replacements and exits 0", () => {
118
- const temp = (0, temp_dir_helpers_1.createTempDir)("maint-cli-");
119
- const dir = temp.dir;
120
- process.chdir(dir);
121
- const tsContent = `/**\n * @story old.path.md\n */`;
122
- fs_1.default.writeFileSync(path_1.default.join(dir, "file.ts"), tsContent, "utf8");
123
- const logSpy = jest.spyOn(console, "log").mockImplementation(() => { });
124
- const code = (0, cli_1.runMaintenanceCli)([
125
- "node",
126
- "traceability-maint",
127
- "update",
128
- "--from",
129
- "old.path.md",
130
- "--to",
131
- "new.path.md",
132
- ]);
133
- try {
134
- expect(code).toBe(0);
135
- const updated = fs_1.default.readFileSync(path_1.default.join(dir, "file.ts"), "utf8");
136
- expect(updated).toContain("@story new.path.md");
137
- }
138
- finally {
139
- logSpy.mockRestore();
140
- temp.cleanup();
141
- }
142
- });
143
- it("[REQ-MAINT-SAFE] update requires --from and --to and exits 2 when missing", () => {
144
- const temp = (0, temp_dir_helpers_1.createTempDir)("maint-cli-");
145
- const dir = temp.dir;
146
- process.chdir(dir);
147
- const errorSpy = jest.spyOn(console, "error").mockImplementation(() => { });
148
- const logSpy = jest.spyOn(console, "log").mockImplementation(() => { });
149
- const code = (0, cli_1.runMaintenanceCli)(["node", "traceability-maint", "update"]);
150
- try {
151
- expect(code).toBe(2);
152
- expect(errorSpy).toHaveBeenCalled();
153
- expect(logSpy).toHaveBeenCalled();
154
- }
155
- finally {
156
- errorSpy.mockRestore();
157
- logSpy.mockRestore();
158
- temp.cleanup();
159
- }
160
- });
161
- it("[REQ-MAINT-SAFE] dry-run does not modify files and exits 0", () => {
162
- const temp = (0, temp_dir_helpers_1.createTempDir)("maint-cli-");
163
- const dir = temp.dir;
164
- process.chdir(dir);
165
- const tsContent = `/**\n * @story old.path.md\n */`;
166
- fs_1.default.writeFileSync(path_1.default.join(dir, "file.ts"), tsContent, "utf8");
167
- const logSpy = jest.spyOn(console, "log").mockImplementation(() => { });
168
- const code = (0, cli_1.runMaintenanceCli)([
169
- "node",
170
- "traceability-maint",
171
- "update",
172
- "--from",
173
- "old.path.md",
174
- "--to",
175
- "new.path.md",
176
- "--dry-run",
177
- ]);
178
- try {
179
- expect(code).toBe(0);
180
- const contentAfter = fs_1.default.readFileSync(path_1.default.join(dir, "file.ts"), "utf8");
181
- expect(contentAfter).toBe(tsContent);
182
- }
183
- finally {
184
- logSpy.mockRestore();
185
- temp.cleanup();
186
- }
187
- });
188
- it("[REQ-MAINT-SAFE] report exits 2 and prints error on invalid --format value", () => {
189
- const temp = (0, temp_dir_helpers_1.createTempDir)("maint-cli-");
190
- const dir = temp.dir;
191
- process.chdir(dir);
192
- const errorSpy = jest.spyOn(console, "error").mockImplementation(() => { });
193
- const logSpy = jest.spyOn(console, "log").mockImplementation(() => { });
194
- const code = (0, cli_1.runMaintenanceCli)([
195
- "node",
196
- "traceability-maint",
197
- "report",
198
- "--format",
199
- "yaml",
200
- ]);
201
- try {
202
- expect(code).toBe(2);
203
- expect(errorSpy).toHaveBeenCalledTimes(1);
204
- const message = String(errorSpy.mock.calls[0][0]);
205
- expect(message).toContain("Invalid format: yaml");
206
- expect(message).toContain("Expected 'text' or 'json'");
207
- }
208
- finally {
209
- errorSpy.mockRestore();
210
- logSpy.mockRestore();
211
- temp.cleanup();
212
- }
213
- });
214
- it("[REQ-MAINT-DETECT] detect supports --json output", () => {
215
- const temp = (0, temp_dir_helpers_1.createTempDir)("maint-cli-");
216
- const dir = temp.dir;
217
- process.chdir(dir);
218
- const tsContent = `/**\n * @story stale.story.md\n */`;
219
- fs_1.default.writeFileSync(path_1.default.join(dir, "file.ts"), tsContent, "utf8");
220
- const logSpy = jest.spyOn(console, "log").mockImplementation(() => { });
221
- const code = (0, cli_1.runMaintenanceCli)([
222
- "node",
223
- "traceability-maint",
224
- "detect",
225
- "--json",
226
- ]);
227
- try {
228
- expect(code).toBe(1);
229
- expect(logSpy).toHaveBeenCalledTimes(1);
230
- const payload = JSON.parse(String(logSpy.mock.calls[0][0]));
231
- expect(Array.isArray(payload.stale)).toBe(true);
232
- expect(payload.stale).toContain("stale.story.md");
233
- }
234
- finally {
235
- logSpy.mockRestore();
236
- temp.cleanup();
237
- }
238
- });
239
- it("[REQ-MAINT-DETECT] detect with non-existent --root exits 0 and reports no stale annotations", () => {
240
- const temp = (0, temp_dir_helpers_1.createTempDir)("maint-cli-");
241
- const dir = temp.dir;
242
- process.chdir(dir);
243
- const missingRoot = path_1.default.join(dir, "missing-root");
244
- const logSpy = jest.spyOn(console, "log").mockImplementation(() => { });
245
- const code = (0, cli_1.runMaintenanceCli)([
246
- "node",
247
- "traceability-maint",
248
- "detect",
249
- "--root",
250
- missingRoot,
251
- ]);
252
- try {
253
- expect(code).toBe(0);
254
- expect(logSpy).toHaveBeenCalledWith("No stale @story annotations found.");
255
- }
256
- finally {
257
- logSpy.mockRestore();
258
- temp.cleanup();
259
- }
260
- });
261
- it("[REQ-MAINT-SAFE] prints help and exits 0 when no subcommand is provided", () => {
262
- const temp = (0, temp_dir_helpers_1.createTempDir)("maint-cli-");
263
- const dir = temp.dir;
264
- process.chdir(dir);
265
- const logSpy = jest.spyOn(console, "log").mockImplementation(() => { });
266
- const errorSpy = jest.spyOn(console, "error").mockImplementation(() => { });
267
- const code = (0, cli_1.runMaintenanceCli)(["node", "traceability-maint"]);
268
- try {
269
- expect(code).toBe(0);
270
- expect(logSpy).toHaveBeenCalled();
271
- const allMessages = logSpy.mock.calls.flat().join("\n");
272
- expect(allMessages).toContain("traceability-maint - Traceability annotation maintenance tools");
273
- expect(errorSpy).not.toHaveBeenCalled();
274
- }
275
- finally {
276
- logSpy.mockRestore();
277
- errorSpy.mockRestore();
278
- temp.cleanup();
279
- }
280
- });
281
- it("[REQ-MAINT-SAFE] detect catches filesystem permission errors and exits 2 with prefixed error message", () => {
282
- const temp = (0, temp_dir_helpers_1.createTempDir)("maint-cli-");
283
- const dir = temp.dir;
284
- process.chdir(dir);
285
- const errorSpy = jest.spyOn(console, "error").mockImplementation(() => { });
286
- const logSpy = jest.spyOn(console, "log").mockImplementation(() => { });
287
- const statSpy = jest.spyOn(fs_1.default, "statSync").mockImplementation(() => {
288
- const err = new Error("EACCES simulated");
289
- err.code = "EACCES";
290
- throw err;
291
- });
292
- const code = (0, cli_1.runMaintenanceCli)(["node", "traceability-maint", "detect"]);
293
- try {
294
- expect(code).toBe(2);
295
- expect(errorSpy).toHaveBeenCalled();
296
- const message = String(errorSpy.mock.calls[0][0]);
297
- expect(message).toContain("traceability-maint failed:");
298
- }
299
- finally {
300
- statSpy.mockRestore();
301
- errorSpy.mockRestore();
302
- logSpy.mockRestore();
303
- temp.cleanup();
304
- }
305
- });
306
- });
@@ -1 +0,0 @@
1
- export {};