eslint-plugin-traceability 1.22.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 (247) hide show
  1. package/CHANGELOG.md +8 -7
  2. package/lib/{src/rules → rules}/require-req-annotation.js +51 -45
  3. package/package.json +9 -13
  4. package/user-docs/api-reference.md +2 -2
  5. package/lib/tests/cli-error-handling.test.d.ts +0 -1
  6. package/lib/tests/cli-error-handling.test.js +0 -54
  7. package/lib/tests/config/eslint-config-validation.test.d.ts +0 -9
  8. package/lib/tests/config/eslint-config-validation.test.js +0 -101
  9. package/lib/tests/config/flat-config-presets-integration.test.d.ts +0 -1
  10. package/lib/tests/config/flat-config-presets-integration.test.js +0 -76
  11. package/lib/tests/config/require-story-annotation-config.test.d.ts +0 -10
  12. package/lib/tests/config/require-story-annotation-config.test.js +0 -26
  13. package/lib/tests/fixtures/stale/example.d.ts +0 -0
  14. package/lib/tests/fixtures/stale/example.js +0 -4
  15. package/lib/tests/fixtures/update/example.d.ts +0 -0
  16. package/lib/tests/fixtures/update/example.js +0 -4
  17. package/lib/tests/fixtures/valid-annotations/example.d.ts +0 -0
  18. package/lib/tests/fixtures/valid-annotations/example.js +0 -3
  19. package/lib/tests/integration/annotation-placement-inside-prettier.integration.test.d.ts +0 -1
  20. package/lib/tests/integration/annotation-placement-inside-prettier.integration.test.js +0 -133
  21. package/lib/tests/integration/catch-annotation-prettier.integration.test.d.ts +0 -1
  22. package/lib/tests/integration/catch-annotation-prettier.integration.test.js +0 -121
  23. package/lib/tests/integration/cli-integration.test.d.ts +0 -1
  24. package/lib/tests/integration/cli-integration.test.js +0 -96
  25. package/lib/tests/integration/else-if-annotation-prettier.integration.test.d.ts +0 -1
  26. package/lib/tests/integration/else-if-annotation-prettier.integration.test.js +0 -100
  27. package/lib/tests/integration/no-redundant-annotation.integration.test.d.ts +0 -1
  28. package/lib/tests/integration/no-redundant-annotation.integration.test.js +0 -129
  29. package/lib/tests/integration/prettier-test-helpers.d.ts +0 -9
  30. package/lib/tests/integration/prettier-test-helpers.js +0 -35
  31. package/lib/tests/integration/require-traceability-aliases.integration.test.d.ts +0 -1
  32. package/lib/tests/integration/require-traceability-aliases.integration.test.js +0 -152
  33. package/lib/tests/integration/require-traceability-test-callbacks.integration.test.d.ts +0 -1
  34. package/lib/tests/integration/require-traceability-test-callbacks.integration.test.js +0 -149
  35. package/lib/tests/maintenance/batch.test.d.ts +0 -1
  36. package/lib/tests/maintenance/batch.test.js +0 -80
  37. package/lib/tests/maintenance/cli.test.d.ts +0 -1
  38. package/lib/tests/maintenance/cli.test.js +0 -306
  39. package/lib/tests/maintenance/detect-isolated.test.d.ts +0 -1
  40. package/lib/tests/maintenance/detect-isolated.test.js +0 -187
  41. package/lib/tests/maintenance/detect.test.d.ts +0 -1
  42. package/lib/tests/maintenance/detect.test.js +0 -46
  43. package/lib/tests/maintenance/index.test.d.ts +0 -1
  44. package/lib/tests/maintenance/index.test.js +0 -26
  45. package/lib/tests/maintenance/report.test.d.ts +0 -1
  46. package/lib/tests/maintenance/report.test.js +0 -68
  47. package/lib/tests/maintenance/storyParser.test.d.ts +0 -8
  48. package/lib/tests/maintenance/storyParser.test.js +0 -505
  49. package/lib/tests/maintenance/update-isolated.test.d.ts +0 -1
  50. package/lib/tests/maintenance/update-isolated.test.js +0 -71
  51. package/lib/tests/maintenance/update.test.d.ts +0 -1
  52. package/lib/tests/maintenance/update.test.js +0 -27
  53. package/lib/tests/perf/maintenance-cli-large-workspace.test.d.ts +0 -1
  54. package/lib/tests/perf/maintenance-cli-large-workspace.test.js +0 -229
  55. package/lib/tests/perf/maintenance-large-workspace.test.d.ts +0 -1
  56. package/lib/tests/perf/maintenance-large-workspace.test.js +0 -169
  57. package/lib/tests/perf/require-branch-annotation-large-file.test.d.ts +0 -1
  58. package/lib/tests/perf/require-branch-annotation-large-file.test.js +0 -67
  59. package/lib/tests/perf/valid-annotation-format-large-file.test.d.ts +0 -1
  60. package/lib/tests/perf/valid-annotation-format-large-file.test.js +0 -75
  61. package/lib/tests/plugin-default-export-and-configs.test.d.ts +0 -1
  62. package/lib/tests/plugin-default-export-and-configs.test.js +0 -121
  63. package/lib/tests/plugin-setup-error.test.d.ts +0 -6
  64. package/lib/tests/plugin-setup-error.test.js +0 -38
  65. package/lib/tests/plugin-setup.test.d.ts +0 -1
  66. package/lib/tests/plugin-setup.test.js +0 -63
  67. package/lib/tests/rules/auto-fix-behavior-008.test.d.ts +0 -1
  68. package/lib/tests/rules/auto-fix-behavior-008.test.js +0 -285
  69. package/lib/tests/rules/error-reporting.test.d.ts +0 -1
  70. package/lib/tests/rules/error-reporting.test.js +0 -99
  71. package/lib/tests/rules/no-redundant-annotation.test.d.ts +0 -1
  72. package/lib/tests/rules/no-redundant-annotation.test.js +0 -163
  73. package/lib/tests/rules/prefer-implements-annotation.test.d.ts +0 -1
  74. package/lib/tests/rules/prefer-implements-annotation.test.js +0 -162
  75. package/lib/tests/rules/require-branch-annotation.test.d.ts +0 -1
  76. package/lib/tests/rules/require-branch-annotation.test.js +0 -593
  77. package/lib/tests/rules/require-req-annotation.test.d.ts +0 -1
  78. package/lib/tests/rules/require-req-annotation.test.js +0 -246
  79. package/lib/tests/rules/require-story-annotation.test.d.ts +0 -1
  80. package/lib/tests/rules/require-story-annotation.test.js +0 -376
  81. package/lib/tests/rules/require-story-core-edgecases.test.d.ts +0 -1
  82. package/lib/tests/rules/require-story-core-edgecases.test.js +0 -15
  83. package/lib/tests/rules/require-story-core.autofix.test.d.ts +0 -1
  84. package/lib/tests/rules/require-story-core.autofix.test.js +0 -66
  85. package/lib/tests/rules/require-story-core.test.d.ts +0 -1
  86. package/lib/tests/rules/require-story-core.test.js +0 -65
  87. package/lib/tests/rules/require-story-helpers-edgecases.test.d.ts +0 -7
  88. package/lib/tests/rules/require-story-helpers-edgecases.test.js +0 -80
  89. package/lib/tests/rules/require-story-helpers.test.d.ts +0 -1
  90. package/lib/tests/rules/require-story-helpers.test.js +0 -474
  91. package/lib/tests/rules/require-story-io-behavior.test.d.ts +0 -7
  92. package/lib/tests/rules/require-story-io-behavior.test.js +0 -46
  93. package/lib/tests/rules/require-story-io.edgecases.test.d.ts +0 -7
  94. package/lib/tests/rules/require-story-io.edgecases.test.js +0 -46
  95. package/lib/tests/rules/require-story-utils.test.d.ts +0 -7
  96. package/lib/tests/rules/require-story-utils.test.js +0 -158
  97. package/lib/tests/rules/require-story-visitors-edgecases.test.d.ts +0 -7
  98. package/lib/tests/rules/require-story-visitors-edgecases.test.js +0 -27
  99. package/lib/tests/rules/require-test-traceability.test.d.ts +0 -1
  100. package/lib/tests/rules/require-test-traceability.test.js +0 -95
  101. package/lib/tests/rules/valid-annotation-format-internal.test.d.ts +0 -8
  102. package/lib/tests/rules/valid-annotation-format-internal.test.js +0 -47
  103. package/lib/tests/rules/valid-annotation-format.test.d.ts +0 -1
  104. package/lib/tests/rules/valid-annotation-format.test.js +0 -634
  105. package/lib/tests/rules/valid-req-reference.test.d.ts +0 -1
  106. package/lib/tests/rules/valid-req-reference.test.js +0 -129
  107. package/lib/tests/rules/valid-story-reference.test.d.ts +0 -1
  108. package/lib/tests/rules/valid-story-reference.test.js +0 -413
  109. package/lib/tests/utils/annotation-checker-autofix-behavior.test.d.ts +0 -5
  110. package/lib/tests/utils/annotation-checker-autofix-behavior.test.js +0 -103
  111. package/lib/tests/utils/annotation-checker.test.d.ts +0 -24
  112. package/lib/tests/utils/annotation-checker.test.js +0 -84
  113. package/lib/tests/utils/annotation-scope-analyzer.test.d.ts +0 -1
  114. package/lib/tests/utils/annotation-scope-analyzer.test.js +0 -211
  115. package/lib/tests/utils/branch-annotation-catch-insert-position.test.d.ts +0 -1
  116. package/lib/tests/utils/branch-annotation-catch-insert-position.test.js +0 -69
  117. package/lib/tests/utils/branch-annotation-catch-position.test.d.ts +0 -1
  118. package/lib/tests/utils/branch-annotation-catch-position.test.js +0 -115
  119. package/lib/tests/utils/branch-annotation-else-if-insert-position.test.d.ts +0 -1
  120. package/lib/tests/utils/branch-annotation-else-if-insert-position.test.js +0 -82
  121. package/lib/tests/utils/branch-annotation-else-if-position.test.d.ts +0 -1
  122. package/lib/tests/utils/branch-annotation-else-if-position.test.js +0 -145
  123. package/lib/tests/utils/branch-annotation-helpers.test.d.ts +0 -1
  124. package/lib/tests/utils/branch-annotation-helpers.test.js +0 -462
  125. package/lib/tests/utils/fsTestHelpers.d.ts +0 -7
  126. package/lib/tests/utils/fsTestHelpers.js +0 -26
  127. package/lib/tests/utils/ioTestHelpers.d.ts +0 -7
  128. package/lib/tests/utils/ioTestHelpers.js +0 -24
  129. package/lib/tests/utils/req-annotation-detection.test.d.ts +0 -1
  130. package/lib/tests/utils/req-annotation-detection.test.js +0 -358
  131. package/lib/tests/utils/require-story-core-test-helpers.d.ts +0 -10
  132. package/lib/tests/utils/require-story-core-test-helpers.js +0 -75
  133. package/lib/tests/utils/temp-dir-helpers.d.ts +0 -19
  134. package/lib/tests/utils/temp-dir-helpers.js +0 -62
  135. package/lib/tests/utils/ts-language-options.d.ts +0 -16
  136. package/lib/tests/utils/ts-language-options.js +0 -30
  137. /package/lib/{src/index.d.ts → index.d.ts} +0 -0
  138. /package/lib/{src/index.js → index.js} +0 -0
  139. /package/lib/{src/maintenance → maintenance}/batch.d.ts +0 -0
  140. /package/lib/{src/maintenance → maintenance}/batch.js +0 -0
  141. /package/lib/{src/maintenance → maintenance}/cli.d.ts +0 -0
  142. /package/lib/{src/maintenance → maintenance}/cli.js +0 -0
  143. /package/lib/{src/maintenance → maintenance}/commands.d.ts +0 -0
  144. /package/lib/{src/maintenance → maintenance}/commands.js +0 -0
  145. /package/lib/{src/maintenance → maintenance}/detect.d.ts +0 -0
  146. /package/lib/{src/maintenance → maintenance}/detect.js +0 -0
  147. /package/lib/{src/maintenance → maintenance}/flags.d.ts +0 -0
  148. /package/lib/{src/maintenance → maintenance}/flags.js +0 -0
  149. /package/lib/{src/maintenance → maintenance}/index.d.ts +0 -0
  150. /package/lib/{src/maintenance → maintenance}/index.js +0 -0
  151. /package/lib/{src/maintenance → maintenance}/report.d.ts +0 -0
  152. /package/lib/{src/maintenance → maintenance}/report.js +0 -0
  153. /package/lib/{src/maintenance → maintenance}/storyParser.d.ts +0 -0
  154. /package/lib/{src/maintenance → maintenance}/storyParser.js +0 -0
  155. /package/lib/{src/maintenance → maintenance}/update.d.ts +0 -0
  156. /package/lib/{src/maintenance → maintenance}/update.js +0 -0
  157. /package/lib/{src/maintenance → maintenance}/utils.d.ts +0 -0
  158. /package/lib/{src/maintenance → maintenance}/utils.js +0 -0
  159. /package/lib/{src/rules → rules}/helpers/pattern-validators.d.ts +0 -0
  160. /package/lib/{src/rules → rules}/helpers/pattern-validators.js +0 -0
  161. /package/lib/{src/rules → rules}/helpers/prefer-implements-inline.d.ts +0 -0
  162. /package/lib/{src/rules → rules}/helpers/prefer-implements-inline.js +0 -0
  163. /package/lib/{src/rules → rules}/helpers/require-story-comment-detection.d.ts +0 -0
  164. /package/lib/{src/rules → rules}/helpers/require-story-comment-detection.js +0 -0
  165. /package/lib/{src/rules → rules}/helpers/require-story-core.d.ts +0 -0
  166. /package/lib/{src/rules → rules}/helpers/require-story-core.js +0 -0
  167. /package/lib/{src/rules → rules}/helpers/require-story-helpers.d.ts +0 -0
  168. /package/lib/{src/rules → rules}/helpers/require-story-helpers.js +0 -0
  169. /package/lib/{src/rules → rules}/helpers/require-story-io.d.ts +0 -0
  170. /package/lib/{src/rules → rules}/helpers/require-story-io.js +0 -0
  171. /package/lib/{src/rules → rules}/helpers/require-story-name-extraction.d.ts +0 -0
  172. /package/lib/{src/rules → rules}/helpers/require-story-name-extraction.js +0 -0
  173. /package/lib/{src/rules → rules}/helpers/require-story-node-utils.d.ts +0 -0
  174. /package/lib/{src/rules → rules}/helpers/require-story-node-utils.js +0 -0
  175. /package/lib/{src/rules → rules}/helpers/require-story-utils.d.ts +0 -0
  176. /package/lib/{src/rules → rules}/helpers/require-story-utils.js +0 -0
  177. /package/lib/{src/rules → rules}/helpers/require-story-visitors.d.ts +0 -0
  178. /package/lib/{src/rules → rules}/helpers/require-story-visitors.js +0 -0
  179. /package/lib/{src/rules → rules}/helpers/require-test-traceability-helpers.d.ts +0 -0
  180. /package/lib/{src/rules → rules}/helpers/require-test-traceability-helpers.js +0 -0
  181. /package/lib/{src/rules → rules}/helpers/test-callback-exclusion.d.ts +0 -0
  182. /package/lib/{src/rules → rules}/helpers/test-callback-exclusion.js +0 -0
  183. /package/lib/{src/rules → rules}/helpers/valid-annotation-format-internal.d.ts +0 -0
  184. /package/lib/{src/rules → rules}/helpers/valid-annotation-format-internal.js +0 -0
  185. /package/lib/{src/rules → rules}/helpers/valid-annotation-format-validators.d.ts +0 -0
  186. /package/lib/{src/rules → rules}/helpers/valid-annotation-format-validators.js +0 -0
  187. /package/lib/{src/rules → rules}/helpers/valid-annotation-options.d.ts +0 -0
  188. /package/lib/{src/rules → rules}/helpers/valid-annotation-options.js +0 -0
  189. /package/lib/{src/rules → rules}/helpers/valid-annotation-utils.d.ts +0 -0
  190. /package/lib/{src/rules → rules}/helpers/valid-annotation-utils.js +0 -0
  191. /package/lib/{src/rules → rules}/helpers/valid-implements-utils.d.ts +0 -0
  192. /package/lib/{src/rules → rules}/helpers/valid-implements-utils.js +0 -0
  193. /package/lib/{src/rules → rules}/helpers/valid-req-reference-helpers.d.ts +0 -0
  194. /package/lib/{src/rules → rules}/helpers/valid-req-reference-helpers.js +0 -0
  195. /package/lib/{src/rules → rules}/helpers/valid-story-reference-helpers.d.ts +0 -0
  196. /package/lib/{src/rules → rules}/helpers/valid-story-reference-helpers.js +0 -0
  197. /package/lib/{src/rules → rules}/no-redundant-annotation.d.ts +0 -0
  198. /package/lib/{src/rules → rules}/no-redundant-annotation.js +0 -0
  199. /package/lib/{src/rules → rules}/prefer-implements-annotation.d.ts +0 -0
  200. /package/lib/{src/rules → rules}/prefer-implements-annotation.js +0 -0
  201. /package/lib/{src/rules → rules}/require-branch-annotation.d.ts +0 -0
  202. /package/lib/{src/rules → rules}/require-branch-annotation.js +0 -0
  203. /package/lib/{src/rules → rules}/require-req-annotation.d.ts +0 -0
  204. /package/lib/{src/rules → rules}/require-story-annotation.d.ts +0 -0
  205. /package/lib/{src/rules → rules}/require-story-annotation.js +0 -0
  206. /package/lib/{src/rules → rules}/require-test-traceability.d.ts +0 -0
  207. /package/lib/{src/rules → rules}/require-test-traceability.js +0 -0
  208. /package/lib/{src/rules → rules}/require-traceability.d.ts +0 -0
  209. /package/lib/{src/rules → rules}/require-traceability.js +0 -0
  210. /package/lib/{src/rules → rules}/valid-annotation-format.d.ts +0 -0
  211. /package/lib/{src/rules → rules}/valid-annotation-format.js +0 -0
  212. /package/lib/{src/rules → rules}/valid-req-reference.d.ts +0 -0
  213. /package/lib/{src/rules → rules}/valid-req-reference.js +0 -0
  214. /package/lib/{src/rules → rules}/valid-story-reference.d.ts +0 -0
  215. /package/lib/{src/rules → rules}/valid-story-reference.js +0 -0
  216. /package/lib/{src/utils → utils}/annotation-checker.d.ts +0 -0
  217. /package/lib/{src/utils → utils}/annotation-checker.js +0 -0
  218. /package/lib/{src/utils → utils}/annotation-scope-analyzer.d.ts +0 -0
  219. /package/lib/{src/utils → utils}/annotation-scope-analyzer.js +0 -0
  220. /package/lib/{src/utils → utils}/branch-annotation-catch-helpers.d.ts +0 -0
  221. /package/lib/{src/utils → utils}/branch-annotation-catch-helpers.js +0 -0
  222. /package/lib/{src/utils → utils}/branch-annotation-helpers.d.ts +0 -0
  223. /package/lib/{src/utils → utils}/branch-annotation-helpers.js +0 -0
  224. /package/lib/{src/utils → utils}/branch-annotation-if-helpers.d.ts +0 -0
  225. /package/lib/{src/utils → utils}/branch-annotation-if-helpers.js +0 -0
  226. /package/lib/{src/utils → utils}/branch-annotation-indent-helpers.d.ts +0 -0
  227. /package/lib/{src/utils → utils}/branch-annotation-indent-helpers.js +0 -0
  228. /package/lib/{src/utils → utils}/branch-annotation-loop-helpers.d.ts +0 -0
  229. /package/lib/{src/utils → utils}/branch-annotation-loop-helpers.js +0 -0
  230. /package/lib/{src/utils → utils}/branch-annotation-report-helpers.d.ts +0 -0
  231. /package/lib/{src/utils → utils}/branch-annotation-report-helpers.js +0 -0
  232. /package/lib/{src/utils → utils}/branch-annotation-story-fix-helpers.d.ts +0 -0
  233. /package/lib/{src/utils → utils}/branch-annotation-story-fix-helpers.js +0 -0
  234. /package/lib/{src/utils → utils}/branch-annotation-switch-helpers.d.ts +0 -0
  235. /package/lib/{src/utils → utils}/branch-annotation-switch-helpers.js +0 -0
  236. /package/lib/{src/utils → utils}/branch-validation.d.ts +0 -0
  237. /package/lib/{src/utils → utils}/branch-validation.js +0 -0
  238. /package/lib/{src/utils → utils}/comment-text-helpers.d.ts +0 -0
  239. /package/lib/{src/utils → utils}/comment-text-helpers.js +0 -0
  240. /package/lib/{src/utils → utils}/function-annotation-helpers.d.ts +0 -0
  241. /package/lib/{src/utils → utils}/function-annotation-helpers.js +0 -0
  242. /package/lib/{src/utils → utils}/redundancy-detector.d.ts +0 -0
  243. /package/lib/{src/utils → utils}/redundancy-detector.js +0 -0
  244. /package/lib/{src/utils → utils}/reqAnnotationDetection.d.ts +0 -0
  245. /package/lib/{src/utils → utils}/reqAnnotationDetection.js +0 -0
  246. /package/lib/{src/utils → utils}/storyReferenceUtils.d.ts +0 -0
  247. /package/lib/{src/utils → utils}/storyReferenceUtils.js +0 -0
@@ -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 {};
@@ -1,187 +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
- /* eslint-disable traceability/valid-annotation-format */
37
- /**
38
- * Tests for: docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
39
- * @story docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
40
- * @req REQ-MAINT-DETECT - Detect stale annotation references
41
- * @supports docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md REQ-MAINT-DETECT
42
- */
43
- const path = __importStar(require("path"));
44
- const os = __importStar(require("os"));
45
- const detect_1 = require("../../src/maintenance/detect");
46
- const fs = require("fs");
47
- describe("detectStaleAnnotations isolated (Story 009.0-DEV-MAINTENANCE-TOOLS)", () => {
48
- it("[REQ-MAINT-DETECT] returns empty array when directory does not exist", () => {
49
- const result = (0, detect_1.detectStaleAnnotations)("non-existent-dir");
50
- expect(result).toEqual([]);
51
- });
52
- it("[REQ-MAINT-DETECT] detects stale annotations in nested directories", () => {
53
- const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "tmp-nested-"));
54
- try {
55
- const nestedDir = path.join(tmpDir, "nested");
56
- fs.mkdirSync(nestedDir);
57
- const filePath1 = path.join(tmpDir, "file1.ts");
58
- const filePath2 = path.join(nestedDir, "file2.ts");
59
- const content1 = `
60
- /**
61
- * @story docs/stories/non-existent-story.story.md
62
- */
63
- `;
64
- fs.writeFileSync(filePath1, content1, "utf8");
65
- const content2 = `
66
- /**
67
- * @story docs/stories/another-non-existent.story.md
68
- */
69
- `;
70
- fs.writeFileSync(filePath2, content2, "utf8");
71
- const result = (0, detect_1.detectStaleAnnotations)(tmpDir);
72
- expect(result).toHaveLength(2);
73
- expect(result).toContain("docs/stories/non-existent-story.story.md");
74
- expect(result).toContain("docs/stories/another-non-existent.story.md");
75
- }
76
- finally {
77
- fs.rmSync(tmpDir, { recursive: true, force: true });
78
- }
79
- });
80
- it("[REQ-MAINT-DETECT] handles permission denied errors by returning an empty result", () => {
81
- const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "tmp-perm-"));
82
- const dir = path.join(tmpDir, "subdir");
83
- fs.mkdirSync(dir);
84
- const filePath = path.join(dir, "file.ts");
85
- const content = `
86
- /**
87
- * @story none.story.md
88
- */
89
- `;
90
- fs.writeFileSync(filePath, content, "utf8");
91
- const originalReadFileSync = fs.readFileSync;
92
- const readSpy = jest
93
- .spyOn(fs, "readFileSync")
94
- .mockImplementation((p, ...args) => {
95
- const strPath = typeof p === "string" ? p : p.toString();
96
- if (strPath === filePath) {
97
- const err = new Error("EACCES: permission denied, open");
98
- err.code = "EACCES";
99
- throw err;
100
- }
101
- // Delegate to original implementation for all other paths
102
- // to keep behavior realistic.
103
- // @ts-ignore
104
- return originalReadFileSync(p, ...args);
105
- });
106
- try {
107
- const result = (0, detect_1.detectStaleAnnotations)(tmpDir);
108
- expect(result).toEqual([]);
109
- }
110
- finally {
111
- readSpy.mockRestore();
112
- try {
113
- fs.rmSync(tmpDir, { recursive: true, force: true });
114
- }
115
- catch {
116
- // ignore cleanup errors
117
- }
118
- }
119
- });
120
- /**
121
- * [REQ-MAINT-DETECT]
122
- * Ensure detectStaleAnnotations performs security validation for unsafe
123
- * and invalid-extension story paths and does not perform filesystem checks
124
- * for malicious @story paths that escape the workspace
125
- * (Story 009.0-DEV-MAINTENANCE-TOOLS).
126
- */
127
- it("[REQ-MAINT-DETECT] performs security validation for unsafe and invalid-extension story paths without stat'ing outside workspace", () => {
128
- const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "tmp-workspace-"));
129
- const maliciousRelative = "../outside-project.story.md";
130
- const maliciousAbsolute = "/etc/passwd.story.md";
131
- const traversalInside = "nested/../inside.story.md";
132
- const invalidExtension = "invalid.txt";
133
- const filePath = path.join(tmpDir, "file.ts");
134
- const content = `
135
- /**
136
- * @story ${maliciousRelative}
137
- * @story ${maliciousAbsolute}
138
- * @story ${traversalInside}
139
- * @story ${invalidExtension}
140
- * @story legitimate.story.md
141
- */
142
- `;
143
- fs.writeFileSync(filePath, content, "utf8");
144
- const existsCalls = [];
145
- const originalExistsSync = fs.existsSync;
146
- const existsSpy = jest
147
- .spyOn(fs, "existsSync")
148
- .mockImplementation((p) => {
149
- const strPath = typeof p === "string" ? p : p.toString();
150
- existsCalls.push(strPath);
151
- return originalExistsSync(p);
152
- });
153
- try {
154
- (0, detect_1.detectStaleAnnotations)(tmpDir);
155
- const allPathsChecked = [...existsCalls];
156
- // Ensure no raw malicious values were checked
157
- expect(allPathsChecked).not.toContain(maliciousRelative);
158
- expect(allPathsChecked).not.toContain(maliciousAbsolute);
159
- expect(allPathsChecked).not.toContain(invalidExtension);
160
- // Also ensure no resolved variants of these paths were checked
161
- const resolvedRelative = path.resolve(tmpDir, maliciousRelative);
162
- const resolvedAbsolute = path.resolve(maliciousAbsolute);
163
- const resolvedInvalid = path.resolve(tmpDir, invalidExtension);
164
- expect(allPathsChecked).not.toContain(resolvedRelative);
165
- expect(allPathsChecked).not.toContain(resolvedAbsolute);
166
- expect(allPathsChecked).not.toContain(resolvedInvalid);
167
- expect(allPathsChecked.some((p) => p.includes("outside-project.story.md"))).toBe(false);
168
- expect(allPathsChecked.some((p) => p.includes("passwd.story.md"))).toBe(false);
169
- expect(allPathsChecked.some((p) => p.includes("invalid.txt"))).toBe(false);
170
- // traversalInside normalizes within workspace and should be checked
171
- const resolvedTraversalInside = path.resolve(tmpDir, traversalInside);
172
- expect(allPathsChecked).toContain(resolvedTraversalInside);
173
- // legitimate in-workspace .story.md path should also be checked
174
- const resolvedLegit = path.resolve(tmpDir, "legitimate.story.md");
175
- expect(allPathsChecked).toContain(resolvedLegit);
176
- }
177
- finally {
178
- existsSpy.mockRestore();
179
- try {
180
- fs.rmSync(tmpDir, { recursive: true, force: true });
181
- }
182
- catch {
183
- // ignore cleanup errors
184
- }
185
- }
186
- });
187
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,46 +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 - Detect stale annotation references
10
- * @supports docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md REQ-MAINT-DETECT
11
- */
12
- const fs_1 = __importDefault(require("fs"));
13
- const path_1 = __importDefault(require("path"));
14
- const os_1 = __importDefault(require("os"));
15
- const detect_1 = require("../../src/maintenance/detect");
16
- describe("detectStaleAnnotations (Story 009.0-DEV-MAINTENANCE-TOOLS)", () => {
17
- it("[REQ-MAINT-DETECT] should return empty array when no stale annotations", () => {
18
- const tmpDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), "detect-test-"));
19
- try {
20
- // No annotation files are created in tmpDir to simulate no stale annotations
21
- const result = (0, detect_1.detectStaleAnnotations)(tmpDir);
22
- expect(result).toEqual([]);
23
- }
24
- finally {
25
- fs_1.default.rmSync(tmpDir, { recursive: true, force: true });
26
- }
27
- });
28
- it("[REQ-MAINT-DETECT] should detect stale annotation references", () => {
29
- const tmpDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), "detect-stale-"));
30
- try {
31
- const filePath = path_1.default.join(tmpDir, "file.ts");
32
- const storyName = "stale.story.md";
33
- const content = `
34
- /**
35
- * @story ${storyName}
36
- */`;
37
- fs_1.default.writeFileSync(filePath, content, "utf8");
38
- const result = (0, detect_1.detectStaleAnnotations)(tmpDir);
39
- expect(result).toHaveLength(1);
40
- expect(result).toContain(storyName);
41
- }
42
- finally {
43
- fs_1.default.rmSync(tmpDir, { recursive: true, force: true });
44
- }
45
- });
46
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /**
4
- * Tests for: docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
5
- * @story docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
6
- * @req REQ-MAINT-SAFE - Ensure all maintenance tools are exported correctly
7
- * @supports docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md REQ-MAINT-SAFE REQ-MAINT-DETECT REQ-MAINT-UPDATE REQ-MAINT-BATCH REQ-MAINT-VERIFY REQ-MAINT-REPORT
8
- */
9
- const maintenance_1 = require("../../src/maintenance");
10
- describe("Maintenance Tools Index Exports (Story 009.0-DEV-MAINTENANCE-TOOLS)", () => {
11
- it("[REQ-MAINT-DETECT] should export detectStaleAnnotations as a function", () => {
12
- expect(typeof maintenance_1.detectStaleAnnotations).toBe("function");
13
- });
14
- it("[REQ-MAINT-UPDATE] should export updateAnnotationReferences as a function", () => {
15
- expect(typeof maintenance_1.updateAnnotationReferences).toBe("function");
16
- });
17
- it("[REQ-MAINT-BATCH] should export batchUpdateAnnotations as a function", () => {
18
- expect(typeof maintenance_1.batchUpdateAnnotations).toBe("function");
19
- });
20
- it("[REQ-MAINT-VERIFY] should export verifyAnnotations as a function", () => {
21
- expect(typeof maintenance_1.verifyAnnotations).toBe("function");
22
- });
23
- it("[REQ-MAINT-REPORT] should export generateMaintenanceReport as a function", () => {
24
- expect(typeof maintenance_1.generateMaintenanceReport).toBe("function");
25
- });
26
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,68 +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-REPORT - Generate maintenance report
40
- * @req REQ-MAINT-SAFE - Ensure operations are safe and reversible
41
- * @supports docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md REQ-MAINT-REPORT REQ-MAINT-SAFE
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 report_1 = require("../../src/maintenance/report");
47
- describe("generateMaintenanceReport (Story 009.0-DEV-MAINTENANCE-TOOLS)", () => {
48
- let temp;
49
- beforeAll(() => {
50
- temp = (0, temp_dir_helpers_1.createTempDir)("report-test-");
51
- });
52
- afterAll(() => {
53
- temp.cleanup();
54
- });
55
- it("[REQ-MAINT-REPORT] should return empty string when no operations", () => {
56
- const report = (0, report_1.generateMaintenanceReport)(temp.dir);
57
- expect(report).toBe("");
58
- });
59
- it("[REQ-MAINT-REPORT] should report stale story annotation", () => {
60
- const filePath = path.join(temp.dir, "stub.md");
61
- const content = `/**
62
- * @story non-existent.story.md
63
- */`;
64
- fs.writeFileSync(filePath, content);
65
- const report = (0, report_1.generateMaintenanceReport)(temp.dir);
66
- expect(report).toContain("non-existent.story.md");
67
- });
68
- });
@@ -1,8 +0,0 @@
1
- /**
2
- * Tests for storyParser module
3
- * @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
4
- * @req REQ-DEEP-PARSE - Test parsing story file content to identify available requirements
5
- * @req REQ-DEEP-FORMAT - Test finding requirement IDs in multiple markdown contexts
6
- * @req REQ-DEEP-SECTION - Test handling requirements in different story file sections
7
- */
8
- export {};