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.
- package/CHANGELOG.md +9 -3
- package/package.json +8 -8
- package/lib/tests/cli-error-handling.test.d.ts +0 -1
- package/lib/tests/cli-error-handling.test.js +0 -54
- package/lib/tests/config/eslint-config-validation.test.d.ts +0 -9
- package/lib/tests/config/eslint-config-validation.test.js +0 -101
- package/lib/tests/config/flat-config-presets-integration.test.d.ts +0 -1
- package/lib/tests/config/flat-config-presets-integration.test.js +0 -76
- package/lib/tests/config/require-story-annotation-config.test.d.ts +0 -10
- package/lib/tests/config/require-story-annotation-config.test.js +0 -26
- package/lib/tests/fixtures/stale/example.d.ts +0 -0
- package/lib/tests/fixtures/stale/example.js +0 -4
- package/lib/tests/fixtures/update/example.d.ts +0 -0
- package/lib/tests/fixtures/update/example.js +0 -4
- package/lib/tests/fixtures/valid-annotations/example.d.ts +0 -0
- package/lib/tests/fixtures/valid-annotations/example.js +0 -3
- package/lib/tests/integration/annotation-placement-inside-prettier.integration.test.d.ts +0 -1
- package/lib/tests/integration/annotation-placement-inside-prettier.integration.test.js +0 -133
- package/lib/tests/integration/catch-annotation-prettier.integration.test.d.ts +0 -1
- package/lib/tests/integration/catch-annotation-prettier.integration.test.js +0 -121
- package/lib/tests/integration/cli-integration.test.d.ts +0 -1
- package/lib/tests/integration/cli-integration.test.js +0 -96
- package/lib/tests/integration/else-if-annotation-prettier.integration.test.d.ts +0 -1
- package/lib/tests/integration/else-if-annotation-prettier.integration.test.js +0 -100
- package/lib/tests/integration/no-redundant-annotation.integration.test.d.ts +0 -1
- package/lib/tests/integration/no-redundant-annotation.integration.test.js +0 -129
- package/lib/tests/integration/prettier-test-helpers.d.ts +0 -9
- package/lib/tests/integration/prettier-test-helpers.js +0 -35
- package/lib/tests/integration/require-traceability-aliases.integration.test.d.ts +0 -1
- package/lib/tests/integration/require-traceability-aliases.integration.test.js +0 -152
- package/lib/tests/integration/require-traceability-test-callbacks.integration.test.d.ts +0 -1
- package/lib/tests/integration/require-traceability-test-callbacks.integration.test.js +0 -149
- package/lib/tests/maintenance/batch.test.d.ts +0 -1
- package/lib/tests/maintenance/batch.test.js +0 -80
- package/lib/tests/maintenance/cli.test.d.ts +0 -1
- package/lib/tests/maintenance/cli.test.js +0 -306
- package/lib/tests/maintenance/detect-isolated.test.d.ts +0 -1
- package/lib/tests/maintenance/detect-isolated.test.js +0 -187
- package/lib/tests/maintenance/detect.test.d.ts +0 -1
- package/lib/tests/maintenance/detect.test.js +0 -46
- package/lib/tests/maintenance/index.test.d.ts +0 -1
- package/lib/tests/maintenance/index.test.js +0 -26
- package/lib/tests/maintenance/report.test.d.ts +0 -1
- package/lib/tests/maintenance/report.test.js +0 -68
- package/lib/tests/maintenance/storyParser.test.d.ts +0 -8
- package/lib/tests/maintenance/storyParser.test.js +0 -505
- package/lib/tests/maintenance/update-isolated.test.d.ts +0 -1
- package/lib/tests/maintenance/update-isolated.test.js +0 -71
- package/lib/tests/maintenance/update.test.d.ts +0 -1
- package/lib/tests/maintenance/update.test.js +0 -27
- package/lib/tests/perf/maintenance-cli-large-workspace.test.d.ts +0 -1
- package/lib/tests/perf/maintenance-cli-large-workspace.test.js +0 -229
- package/lib/tests/perf/maintenance-large-workspace.test.d.ts +0 -1
- package/lib/tests/perf/maintenance-large-workspace.test.js +0 -169
- package/lib/tests/perf/require-branch-annotation-large-file.test.d.ts +0 -1
- package/lib/tests/perf/require-branch-annotation-large-file.test.js +0 -67
- package/lib/tests/perf/valid-annotation-format-large-file.test.d.ts +0 -1
- package/lib/tests/perf/valid-annotation-format-large-file.test.js +0 -75
- package/lib/tests/plugin-default-export-and-configs.test.d.ts +0 -1
- package/lib/tests/plugin-default-export-and-configs.test.js +0 -121
- package/lib/tests/plugin-setup-error.test.d.ts +0 -6
- package/lib/tests/plugin-setup-error.test.js +0 -38
- package/lib/tests/plugin-setup.test.d.ts +0 -1
- package/lib/tests/plugin-setup.test.js +0 -63
- package/lib/tests/rules/auto-fix-behavior-008.test.d.ts +0 -1
- package/lib/tests/rules/auto-fix-behavior-008.test.js +0 -285
- package/lib/tests/rules/error-reporting.test.d.ts +0 -1
- package/lib/tests/rules/error-reporting.test.js +0 -99
- package/lib/tests/rules/no-redundant-annotation.test.d.ts +0 -1
- package/lib/tests/rules/no-redundant-annotation.test.js +0 -163
- package/lib/tests/rules/prefer-implements-annotation.test.d.ts +0 -1
- package/lib/tests/rules/prefer-implements-annotation.test.js +0 -162
- package/lib/tests/rules/require-branch-annotation.test.d.ts +0 -1
- package/lib/tests/rules/require-branch-annotation.test.js +0 -593
- package/lib/tests/rules/require-req-annotation.test.d.ts +0 -1
- package/lib/tests/rules/require-req-annotation.test.js +0 -264
- package/lib/tests/rules/require-story-annotation.test.d.ts +0 -1
- package/lib/tests/rules/require-story-annotation.test.js +0 -376
- package/lib/tests/rules/require-story-core-edgecases.test.d.ts +0 -1
- package/lib/tests/rules/require-story-core-edgecases.test.js +0 -15
- package/lib/tests/rules/require-story-core.autofix.test.d.ts +0 -1
- package/lib/tests/rules/require-story-core.autofix.test.js +0 -66
- package/lib/tests/rules/require-story-core.test.d.ts +0 -1
- package/lib/tests/rules/require-story-core.test.js +0 -65
- package/lib/tests/rules/require-story-helpers-edgecases.test.d.ts +0 -7
- package/lib/tests/rules/require-story-helpers-edgecases.test.js +0 -80
- package/lib/tests/rules/require-story-helpers.test.d.ts +0 -1
- package/lib/tests/rules/require-story-helpers.test.js +0 -474
- package/lib/tests/rules/require-story-io-behavior.test.d.ts +0 -7
- package/lib/tests/rules/require-story-io-behavior.test.js +0 -46
- package/lib/tests/rules/require-story-io.edgecases.test.d.ts +0 -7
- package/lib/tests/rules/require-story-io.edgecases.test.js +0 -46
- package/lib/tests/rules/require-story-utils.test.d.ts +0 -7
- package/lib/tests/rules/require-story-utils.test.js +0 -158
- package/lib/tests/rules/require-story-visitors-edgecases.test.d.ts +0 -7
- package/lib/tests/rules/require-story-visitors-edgecases.test.js +0 -27
- package/lib/tests/rules/require-test-traceability.test.d.ts +0 -1
- package/lib/tests/rules/require-test-traceability.test.js +0 -95
- package/lib/tests/rules/valid-annotation-format-internal.test.d.ts +0 -8
- package/lib/tests/rules/valid-annotation-format-internal.test.js +0 -47
- package/lib/tests/rules/valid-annotation-format.test.d.ts +0 -1
- package/lib/tests/rules/valid-annotation-format.test.js +0 -634
- package/lib/tests/rules/valid-req-reference.test.d.ts +0 -1
- package/lib/tests/rules/valid-req-reference.test.js +0 -129
- package/lib/tests/rules/valid-story-reference.test.d.ts +0 -1
- package/lib/tests/rules/valid-story-reference.test.js +0 -413
- package/lib/tests/utils/annotation-checker-autofix-behavior.test.d.ts +0 -5
- package/lib/tests/utils/annotation-checker-autofix-behavior.test.js +0 -103
- package/lib/tests/utils/annotation-checker.test.d.ts +0 -24
- package/lib/tests/utils/annotation-checker.test.js +0 -84
- package/lib/tests/utils/annotation-scope-analyzer.test.d.ts +0 -1
- package/lib/tests/utils/annotation-scope-analyzer.test.js +0 -211
- package/lib/tests/utils/branch-annotation-catch-insert-position.test.d.ts +0 -1
- package/lib/tests/utils/branch-annotation-catch-insert-position.test.js +0 -69
- package/lib/tests/utils/branch-annotation-catch-position.test.d.ts +0 -1
- package/lib/tests/utils/branch-annotation-catch-position.test.js +0 -115
- package/lib/tests/utils/branch-annotation-else-if-insert-position.test.d.ts +0 -1
- package/lib/tests/utils/branch-annotation-else-if-insert-position.test.js +0 -82
- package/lib/tests/utils/branch-annotation-else-if-position.test.d.ts +0 -1
- package/lib/tests/utils/branch-annotation-else-if-position.test.js +0 -145
- package/lib/tests/utils/branch-annotation-helpers.test.d.ts +0 -1
- package/lib/tests/utils/branch-annotation-helpers.test.js +0 -462
- package/lib/tests/utils/fsTestHelpers.d.ts +0 -7
- package/lib/tests/utils/fsTestHelpers.js +0 -26
- package/lib/tests/utils/ioTestHelpers.d.ts +0 -7
- package/lib/tests/utils/ioTestHelpers.js +0 -24
- package/lib/tests/utils/req-annotation-detection.test.d.ts +0 -1
- package/lib/tests/utils/req-annotation-detection.test.js +0 -358
- package/lib/tests/utils/require-story-core-test-helpers.d.ts +0 -10
- package/lib/tests/utils/require-story-core-test-helpers.js +0 -75
- package/lib/tests/utils/temp-dir-helpers.d.ts +0 -19
- package/lib/tests/utils/temp-dir-helpers.js +0 -62
- package/lib/tests/utils/ts-language-options.d.ts +0 -16
- package/lib/tests/utils/ts-language-options.js +0 -30
- /package/lib/{src/index.d.ts → index.d.ts} +0 -0
- /package/lib/{src/index.js → index.js} +0 -0
- /package/lib/{src/maintenance → maintenance}/batch.d.ts +0 -0
- /package/lib/{src/maintenance → maintenance}/batch.js +0 -0
- /package/lib/{src/maintenance → maintenance}/cli.d.ts +0 -0
- /package/lib/{src/maintenance → maintenance}/cli.js +0 -0
- /package/lib/{src/maintenance → maintenance}/commands.d.ts +0 -0
- /package/lib/{src/maintenance → maintenance}/commands.js +0 -0
- /package/lib/{src/maintenance → maintenance}/detect.d.ts +0 -0
- /package/lib/{src/maintenance → maintenance}/detect.js +0 -0
- /package/lib/{src/maintenance → maintenance}/flags.d.ts +0 -0
- /package/lib/{src/maintenance → maintenance}/flags.js +0 -0
- /package/lib/{src/maintenance → maintenance}/index.d.ts +0 -0
- /package/lib/{src/maintenance → maintenance}/index.js +0 -0
- /package/lib/{src/maintenance → maintenance}/report.d.ts +0 -0
- /package/lib/{src/maintenance → maintenance}/report.js +0 -0
- /package/lib/{src/maintenance → maintenance}/storyParser.d.ts +0 -0
- /package/lib/{src/maintenance → maintenance}/storyParser.js +0 -0
- /package/lib/{src/maintenance → maintenance}/update.d.ts +0 -0
- /package/lib/{src/maintenance → maintenance}/update.js +0 -0
- /package/lib/{src/maintenance → maintenance}/utils.d.ts +0 -0
- /package/lib/{src/maintenance → maintenance}/utils.js +0 -0
- /package/lib/{src/rules → rules}/helpers/pattern-validators.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/pattern-validators.js +0 -0
- /package/lib/{src/rules → rules}/helpers/prefer-implements-inline.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/prefer-implements-inline.js +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-comment-detection.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-comment-detection.js +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-core.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-core.js +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-helpers.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-helpers.js +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-io.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-io.js +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-name-extraction.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-name-extraction.js +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-node-utils.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-node-utils.js +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-utils.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-utils.js +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-visitors.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/require-story-visitors.js +0 -0
- /package/lib/{src/rules → rules}/helpers/require-test-traceability-helpers.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/require-test-traceability-helpers.js +0 -0
- /package/lib/{src/rules → rules}/helpers/test-callback-exclusion.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/test-callback-exclusion.js +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-annotation-format-internal.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-annotation-format-internal.js +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-annotation-format-validators.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-annotation-format-validators.js +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-annotation-options.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-annotation-options.js +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-annotation-utils.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-annotation-utils.js +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-implements-utils.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-implements-utils.js +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-req-reference-helpers.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-req-reference-helpers.js +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-story-reference-helpers.d.ts +0 -0
- /package/lib/{src/rules → rules}/helpers/valid-story-reference-helpers.js +0 -0
- /package/lib/{src/rules → rules}/no-redundant-annotation.d.ts +0 -0
- /package/lib/{src/rules → rules}/no-redundant-annotation.js +0 -0
- /package/lib/{src/rules → rules}/prefer-implements-annotation.d.ts +0 -0
- /package/lib/{src/rules → rules}/prefer-implements-annotation.js +0 -0
- /package/lib/{src/rules → rules}/require-branch-annotation.d.ts +0 -0
- /package/lib/{src/rules → rules}/require-branch-annotation.js +0 -0
- /package/lib/{src/rules → rules}/require-req-annotation.d.ts +0 -0
- /package/lib/{src/rules → rules}/require-req-annotation.js +0 -0
- /package/lib/{src/rules → rules}/require-story-annotation.d.ts +0 -0
- /package/lib/{src/rules → rules}/require-story-annotation.js +0 -0
- /package/lib/{src/rules → rules}/require-test-traceability.d.ts +0 -0
- /package/lib/{src/rules → rules}/require-test-traceability.js +0 -0
- /package/lib/{src/rules → rules}/require-traceability.d.ts +0 -0
- /package/lib/{src/rules → rules}/require-traceability.js +0 -0
- /package/lib/{src/rules → rules}/valid-annotation-format.d.ts +0 -0
- /package/lib/{src/rules → rules}/valid-annotation-format.js +0 -0
- /package/lib/{src/rules → rules}/valid-req-reference.d.ts +0 -0
- /package/lib/{src/rules → rules}/valid-req-reference.js +0 -0
- /package/lib/{src/rules → rules}/valid-story-reference.d.ts +0 -0
- /package/lib/{src/rules → rules}/valid-story-reference.js +0 -0
- /package/lib/{src/utils → utils}/annotation-checker.d.ts +0 -0
- /package/lib/{src/utils → utils}/annotation-checker.js +0 -0
- /package/lib/{src/utils → utils}/annotation-scope-analyzer.d.ts +0 -0
- /package/lib/{src/utils → utils}/annotation-scope-analyzer.js +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-catch-helpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-catch-helpers.js +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-helpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-helpers.js +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-if-helpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-if-helpers.js +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-indent-helpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-indent-helpers.js +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-loop-helpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-loop-helpers.js +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-report-helpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-report-helpers.js +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-story-fix-helpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-story-fix-helpers.js +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-switch-helpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/branch-annotation-switch-helpers.js +0 -0
- /package/lib/{src/utils → utils}/branch-validation.d.ts +0 -0
- /package/lib/{src/utils → utils}/branch-validation.js +0 -0
- /package/lib/{src/utils → utils}/comment-text-helpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/comment-text-helpers.js +0 -0
- /package/lib/{src/utils → utils}/function-annotation-helpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/function-annotation-helpers.js +0 -0
- /package/lib/{src/utils → utils}/redundancy-detector.d.ts +0 -0
- /package/lib/{src/utils → utils}/redundancy-detector.js +0 -0
- /package/lib/{src/utils → utils}/reqAnnotationDetection.d.ts +0 -0
- /package/lib/{src/utils → utils}/reqAnnotationDetection.js +0 -0
- /package/lib/{src/utils → utils}/storyReferenceUtils.d.ts +0 -0
- /package/lib/{src/utils → utils}/storyReferenceUtils.js +0 -0
|
@@ -1,505 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Tests for storyParser module
|
|
4
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
5
|
-
* @req REQ-DEEP-PARSE - Test parsing story file content to identify available requirements
|
|
6
|
-
* @req REQ-DEEP-FORMAT - Test finding requirement IDs in multiple markdown contexts
|
|
7
|
-
* @req REQ-DEEP-SECTION - Test handling requirements in different story file sections
|
|
8
|
-
*/
|
|
9
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(o, k2, desc);
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
24
|
-
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
-
var ownKeys = function(o) {
|
|
27
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
-
var ar = [];
|
|
29
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
-
return ar;
|
|
31
|
-
};
|
|
32
|
-
return ownKeys(o);
|
|
33
|
-
};
|
|
34
|
-
return function (mod) {
|
|
35
|
-
if (mod && mod.__esModule) return mod;
|
|
36
|
-
var result = {};
|
|
37
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
-
__setModuleDefault(result, mod);
|
|
39
|
-
return result;
|
|
40
|
-
};
|
|
41
|
-
})();
|
|
42
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
const fs = __importStar(require("fs"));
|
|
44
|
-
const path = __importStar(require("path"));
|
|
45
|
-
const os = __importStar(require("os"));
|
|
46
|
-
const storyParser_1 = require("../../src/maintenance/storyParser");
|
|
47
|
-
describe("storyParser", () => {
|
|
48
|
-
describe("extractRequirementsFromContent", () => {
|
|
49
|
-
/**
|
|
50
|
-
* Test extraction from structured ## Requirements section
|
|
51
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
52
|
-
* @req REQ-DEEP-SECTION - Parse ## Requirements sections
|
|
53
|
-
*/
|
|
54
|
-
it("should extract requirements from ## Requirements section", () => {
|
|
55
|
-
const content = `
|
|
56
|
-
# Story Title
|
|
57
|
-
|
|
58
|
-
## Requirements
|
|
59
|
-
|
|
60
|
-
- **REQ-FOO-001**: First requirement
|
|
61
|
-
- **REQ-FOO-002**: Second requirement
|
|
62
|
-
- **REQ-BAR-003**: Third requirement
|
|
63
|
-
|
|
64
|
-
## Other Section
|
|
65
|
-
`;
|
|
66
|
-
const requirements = (0, storyParser_1.extractRequirementsFromContent)(content);
|
|
67
|
-
expect(requirements).toEqual(new Set(["REQ-FOO-001", "REQ-FOO-002", "REQ-BAR-003"]));
|
|
68
|
-
});
|
|
69
|
-
/**
|
|
70
|
-
* Test extraction from ## Acceptance Criteria section
|
|
71
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
72
|
-
* @req REQ-DEEP-SECTION - Parse ## Acceptance Criteria sections
|
|
73
|
-
*/
|
|
74
|
-
it("should extract requirements from ## Acceptance Criteria section", () => {
|
|
75
|
-
const content = `
|
|
76
|
-
# Story Title
|
|
77
|
-
|
|
78
|
-
## Acceptance Criteria
|
|
79
|
-
|
|
80
|
-
- **REQ-AC-001**: Acceptance criterion one
|
|
81
|
-
- **REQ-AC-002**: Acceptance criterion two
|
|
82
|
-
|
|
83
|
-
## Other Section
|
|
84
|
-
`;
|
|
85
|
-
const requirements = (0, storyParser_1.extractRequirementsFromContent)(content);
|
|
86
|
-
expect(requirements).toEqual(new Set(["REQ-AC-001", "REQ-AC-002"]));
|
|
87
|
-
});
|
|
88
|
-
/**
|
|
89
|
-
* Test extraction from both structured sections
|
|
90
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
91
|
-
* @req REQ-DEEP-SECTION - Handle requirements in different story file sections
|
|
92
|
-
*/
|
|
93
|
-
it("should extract requirements from both Requirements and Acceptance Criteria sections", () => {
|
|
94
|
-
const content = `
|
|
95
|
-
# Story Title
|
|
96
|
-
|
|
97
|
-
## Requirements
|
|
98
|
-
|
|
99
|
-
- **REQ-REQ-001**: First requirement
|
|
100
|
-
|
|
101
|
-
## Acceptance Criteria
|
|
102
|
-
|
|
103
|
-
- **REQ-AC-001**: First criterion
|
|
104
|
-
|
|
105
|
-
## Implementation Notes
|
|
106
|
-
`;
|
|
107
|
-
const requirements = (0, storyParser_1.extractRequirementsFromContent)(content);
|
|
108
|
-
expect(requirements).toEqual(new Set(["REQ-REQ-001", "REQ-AC-001"]));
|
|
109
|
-
});
|
|
110
|
-
/**
|
|
111
|
-
* Test extraction with bold format
|
|
112
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
113
|
-
* @req REQ-DEEP-FORMAT - Extract from bold requirement format
|
|
114
|
-
*/
|
|
115
|
-
it("should extract requirements in bold format **REQ-XXX-YYY**", () => {
|
|
116
|
-
const content = `
|
|
117
|
-
## Requirements
|
|
118
|
-
|
|
119
|
-
- **REQ-BOLD-001**: Description here
|
|
120
|
-
- Some text with **REQ-BOLD-002** in the middle
|
|
121
|
-
`;
|
|
122
|
-
const requirements = (0, storyParser_1.extractRequirementsFromContent)(content);
|
|
123
|
-
expect(requirements).toEqual(new Set(["REQ-BOLD-001", "REQ-BOLD-002"]));
|
|
124
|
-
});
|
|
125
|
-
/**
|
|
126
|
-
* Test extraction with plain text format
|
|
127
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
128
|
-
* @req REQ-DEEP-FORMAT - Extract from plain text mentions
|
|
129
|
-
*/
|
|
130
|
-
it("should extract requirements in plain text format REQ-XXX-YYY", () => {
|
|
131
|
-
const content = `
|
|
132
|
-
## Requirements
|
|
133
|
-
|
|
134
|
-
- REQ-PLAIN-001: Description here
|
|
135
|
-
- Some text with REQ-PLAIN-002 in the middle
|
|
136
|
-
`;
|
|
137
|
-
const requirements = (0, storyParser_1.extractRequirementsFromContent)(content);
|
|
138
|
-
expect(requirements).toEqual(new Set(["REQ-PLAIN-001", "REQ-PLAIN-002"]));
|
|
139
|
-
});
|
|
140
|
-
/**
|
|
141
|
-
* Test extraction from multiple line formats
|
|
142
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
143
|
-
* @req REQ-DEEP-FORMAT - Support finding requirement IDs in multiple markdown contexts
|
|
144
|
-
*/
|
|
145
|
-
it("should extract requirements from mixed formats", () => {
|
|
146
|
-
const content = `
|
|
147
|
-
## Requirements
|
|
148
|
-
|
|
149
|
-
- **REQ-MIX-001**: Bold format
|
|
150
|
-
- REQ-MIX-002: Plain format
|
|
151
|
-
- Description mentions REQ-MIX-003 inline
|
|
152
|
-
- Multiple **REQ-MIX-004** and REQ-MIX-005 in one line
|
|
153
|
-
`;
|
|
154
|
-
const requirements = (0, storyParser_1.extractRequirementsFromContent)(content);
|
|
155
|
-
expect(requirements).toEqual(new Set([
|
|
156
|
-
"REQ-MIX-001",
|
|
157
|
-
"REQ-MIX-002",
|
|
158
|
-
"REQ-MIX-003",
|
|
159
|
-
"REQ-MIX-004",
|
|
160
|
-
"REQ-MIX-005",
|
|
161
|
-
]));
|
|
162
|
-
});
|
|
163
|
-
/**
|
|
164
|
-
* Test regex fallback for requirements outside sections
|
|
165
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
166
|
-
* @req REQ-DEEP-FORMAT - Support finding requirement IDs in multiple markdown contexts
|
|
167
|
-
*/
|
|
168
|
-
it("should extract requirements outside structured sections using regex fallback", () => {
|
|
169
|
-
const content = `
|
|
170
|
-
# Story Title
|
|
171
|
-
|
|
172
|
-
This story implements REQ-FALLBACK-001 and REQ-FALLBACK-002.
|
|
173
|
-
|
|
174
|
-
## Implementation
|
|
175
|
-
|
|
176
|
-
Code example:
|
|
177
|
-
// @req REQ-FALLBACK-003 - This requirement is in a code comment
|
|
178
|
-
`;
|
|
179
|
-
const requirements = (0, storyParser_1.extractRequirementsFromContent)(content);
|
|
180
|
-
expect(requirements).toEqual(new Set(["REQ-FALLBACK-001", "REQ-FALLBACK-002", "REQ-FALLBACK-003"]));
|
|
181
|
-
});
|
|
182
|
-
/**
|
|
183
|
-
* Test handling of empty content
|
|
184
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
185
|
-
* @req REQ-DEEP-PARSE - Handle edge cases gracefully
|
|
186
|
-
*/
|
|
187
|
-
it("should return empty set for empty content", () => {
|
|
188
|
-
const requirements = (0, storyParser_1.extractRequirementsFromContent)("");
|
|
189
|
-
expect(requirements).toEqual(new Set());
|
|
190
|
-
});
|
|
191
|
-
/**
|
|
192
|
-
* Test handling of content with no requirements
|
|
193
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
194
|
-
* @req REQ-DEEP-PARSE - Handle edge cases gracefully
|
|
195
|
-
*/
|
|
196
|
-
it("should return empty set for content with no requirements", () => {
|
|
197
|
-
const content = `
|
|
198
|
-
# Story Title
|
|
199
|
-
|
|
200
|
-
## Description
|
|
201
|
-
|
|
202
|
-
This story has no requirements mentioned.
|
|
203
|
-
|
|
204
|
-
## Implementation Notes
|
|
205
|
-
|
|
206
|
-
Just some notes here.
|
|
207
|
-
`;
|
|
208
|
-
const requirements = (0, storyParser_1.extractRequirementsFromContent)(content);
|
|
209
|
-
expect(requirements).toEqual(new Set());
|
|
210
|
-
});
|
|
211
|
-
/**
|
|
212
|
-
* Test case sensitivity
|
|
213
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
214
|
-
* @req REQ-DEEP-FORMAT - Extract requirement IDs correctly
|
|
215
|
-
*/
|
|
216
|
-
it("should handle different casing in section headers", () => {
|
|
217
|
-
const content = `
|
|
218
|
-
## requirements
|
|
219
|
-
|
|
220
|
-
- **REQ-LOWER-001**: From lowercase section
|
|
221
|
-
|
|
222
|
-
## REQUIREMENTS
|
|
223
|
-
|
|
224
|
-
- **REQ-UPPER-001**: From uppercase section
|
|
225
|
-
|
|
226
|
-
## Requirements
|
|
227
|
-
|
|
228
|
-
- **REQ-TITLE-001**: From title case section
|
|
229
|
-
`;
|
|
230
|
-
const requirements = (0, storyParser_1.extractRequirementsFromContent)(content);
|
|
231
|
-
expect(requirements).toEqual(new Set(["REQ-LOWER-001", "REQ-UPPER-001", "REQ-TITLE-001"]));
|
|
232
|
-
});
|
|
233
|
-
/**
|
|
234
|
-
* Test section boundary detection
|
|
235
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
236
|
-
* @req REQ-DEEP-SECTION - Handle requirements in different story file sections
|
|
237
|
-
*/
|
|
238
|
-
it("should stop extracting when encountering new section header", () => {
|
|
239
|
-
const content = `
|
|
240
|
-
## Requirements
|
|
241
|
-
|
|
242
|
-
- **REQ-SEC-001**: Should be extracted
|
|
243
|
-
|
|
244
|
-
## Implementation Notes
|
|
245
|
-
|
|
246
|
-
- **REQ-SEC-002**: Should be extracted via regex fallback only
|
|
247
|
-
`;
|
|
248
|
-
const requirements = (0, storyParser_1.extractRequirementsFromContent)(content);
|
|
249
|
-
// Both should be extracted, but REQ-SEC-002 via regex fallback
|
|
250
|
-
expect(requirements).toEqual(new Set(["REQ-SEC-001", "REQ-SEC-002"]));
|
|
251
|
-
});
|
|
252
|
-
/**
|
|
253
|
-
* Test multiple occurrences of same requirement
|
|
254
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
255
|
-
* @req REQ-DEEP-PARSE - Avoid duplicate requirements in results
|
|
256
|
-
*/
|
|
257
|
-
it("should deduplicate repeated requirements", () => {
|
|
258
|
-
const content = `
|
|
259
|
-
## Requirements
|
|
260
|
-
|
|
261
|
-
- **REQ-DUP-001**: First mention
|
|
262
|
-
- REQ-DUP-001: Second mention
|
|
263
|
-
|
|
264
|
-
## Acceptance Criteria
|
|
265
|
-
|
|
266
|
-
- REQ-DUP-001: Third mention
|
|
267
|
-
`;
|
|
268
|
-
const requirements = (0, storyParser_1.extractRequirementsFromContent)(content);
|
|
269
|
-
expect(requirements).toEqual(new Set(["REQ-DUP-001"]));
|
|
270
|
-
expect(requirements.size).toBe(1);
|
|
271
|
-
});
|
|
272
|
-
/**
|
|
273
|
-
* Test requirements with hyphens in ID
|
|
274
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
275
|
-
* @req REQ-DEEP-FORMAT - Support requirement ID format with multiple hyphens
|
|
276
|
-
*/
|
|
277
|
-
it("should extract requirements with multiple hyphens in ID", () => {
|
|
278
|
-
const content = `
|
|
279
|
-
## Requirements
|
|
280
|
-
|
|
281
|
-
- **REQ-MULTI-HYPHEN-001**: Complex ID
|
|
282
|
-
- **REQ-A-B-C-D-123**: Very complex ID
|
|
283
|
-
`;
|
|
284
|
-
const requirements = (0, storyParser_1.extractRequirementsFromContent)(content);
|
|
285
|
-
expect(requirements).toEqual(new Set(["REQ-MULTI-HYPHEN-001", "REQ-A-B-C-D-123"]));
|
|
286
|
-
});
|
|
287
|
-
/**
|
|
288
|
-
* Test requirements with numbers in various positions
|
|
289
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
290
|
-
* @req REQ-DEEP-FORMAT - Support alphanumeric requirement IDs
|
|
291
|
-
*/
|
|
292
|
-
it("should extract requirements with numbers in various positions", () => {
|
|
293
|
-
const content = `
|
|
294
|
-
## Requirements
|
|
295
|
-
|
|
296
|
-
- **REQ-123-ABC**: Numbers first
|
|
297
|
-
- **REQ-ABC-123**: Numbers last
|
|
298
|
-
- **REQ-A1B2C3**: Numbers mixed
|
|
299
|
-
`;
|
|
300
|
-
const requirements = (0, storyParser_1.extractRequirementsFromContent)(content);
|
|
301
|
-
expect(requirements).toEqual(new Set(["REQ-123-ABC", "REQ-ABC-123", "REQ-A1B2C3"]));
|
|
302
|
-
});
|
|
303
|
-
/**
|
|
304
|
-
* Test nested list items
|
|
305
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
306
|
-
* @req REQ-DEEP-FORMAT - Handle requirements in nested list structures
|
|
307
|
-
*/
|
|
308
|
-
it("should extract requirements from nested list items", () => {
|
|
309
|
-
const content = `
|
|
310
|
-
## Requirements
|
|
311
|
-
|
|
312
|
-
- **REQ-NEST-001**: Top level
|
|
313
|
-
- **REQ-NEST-002**: Nested item
|
|
314
|
-
- **REQ-NEST-003**: Deeply nested
|
|
315
|
-
`;
|
|
316
|
-
const requirements = (0, storyParser_1.extractRequirementsFromContent)(content);
|
|
317
|
-
expect(requirements).toEqual(new Set(["REQ-NEST-001", "REQ-NEST-002", "REQ-NEST-003"]));
|
|
318
|
-
});
|
|
319
|
-
/**
|
|
320
|
-
* Test requirements in tables
|
|
321
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
322
|
-
* @req REQ-DEEP-FORMAT - Support finding requirement IDs in tables
|
|
323
|
-
*/
|
|
324
|
-
it("should extract requirements from markdown tables", () => {
|
|
325
|
-
const content = `
|
|
326
|
-
## Requirements
|
|
327
|
-
|
|
328
|
-
| ID | Description |
|
|
329
|
-
|----|-------------|
|
|
330
|
-
| REQ-TABLE-001 | First requirement |
|
|
331
|
-
| REQ-TABLE-002 | Second requirement |
|
|
332
|
-
`;
|
|
333
|
-
const requirements = (0, storyParser_1.extractRequirementsFromContent)(content);
|
|
334
|
-
expect(requirements).toEqual(new Set(["REQ-TABLE-001", "REQ-TABLE-002"]));
|
|
335
|
-
});
|
|
336
|
-
/**
|
|
337
|
-
* Test requirements with special characters nearby
|
|
338
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
339
|
-
* @req REQ-DEEP-FORMAT - Handle requirement IDs with adjacent punctuation
|
|
340
|
-
*/
|
|
341
|
-
it("should extract requirements adjacent to punctuation", () => {
|
|
342
|
-
const content = `
|
|
343
|
-
## Requirements
|
|
344
|
-
|
|
345
|
-
- (REQ-PUNC-001): In parentheses
|
|
346
|
-
- [REQ-PUNC-002]: In brackets
|
|
347
|
-
- REQ-PUNC-003, REQ-PUNC-004: Comma separated
|
|
348
|
-
- REQ-PUNC-005. With period after
|
|
349
|
-
`;
|
|
350
|
-
const requirements = (0, storyParser_1.extractRequirementsFromContent)(content);
|
|
351
|
-
expect(requirements).toEqual(new Set([
|
|
352
|
-
"REQ-PUNC-001",
|
|
353
|
-
"REQ-PUNC-002",
|
|
354
|
-
"REQ-PUNC-003",
|
|
355
|
-
"REQ-PUNC-004",
|
|
356
|
-
"REQ-PUNC-005",
|
|
357
|
-
]));
|
|
358
|
-
});
|
|
359
|
-
/**
|
|
360
|
-
* Test multiline content within section
|
|
361
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
362
|
-
* @req REQ-DEEP-FORMAT - Handle multiline requirement descriptions
|
|
363
|
-
*/
|
|
364
|
-
it("should extract requirements from multiline descriptions", () => {
|
|
365
|
-
const content = `
|
|
366
|
-
## Requirements
|
|
367
|
-
|
|
368
|
-
- **REQ-MULTI-001**: This is a long description
|
|
369
|
-
that spans multiple lines
|
|
370
|
-
and continues here
|
|
371
|
-
- **REQ-MULTI-002**: Another requirement
|
|
372
|
-
`;
|
|
373
|
-
const requirements = (0, storyParser_1.extractRequirementsFromContent)(content);
|
|
374
|
-
expect(requirements).toEqual(new Set(["REQ-MULTI-001", "REQ-MULTI-002"]));
|
|
375
|
-
});
|
|
376
|
-
});
|
|
377
|
-
describe("extractRequirementsFromStoryFile", () => {
|
|
378
|
-
let tempDir;
|
|
379
|
-
beforeEach(async () => {
|
|
380
|
-
// Create temp directory for test files
|
|
381
|
-
tempDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "story-parser-test-"));
|
|
382
|
-
});
|
|
383
|
-
afterEach(async () => {
|
|
384
|
-
// Clean up temp directory
|
|
385
|
-
await fs.promises.rm(tempDir, { recursive: true, force: true });
|
|
386
|
-
});
|
|
387
|
-
/**
|
|
388
|
-
* Test reading from actual file
|
|
389
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
390
|
-
* @req REQ-DEEP-PARSE - Parse story file content from filesystem
|
|
391
|
-
*/
|
|
392
|
-
it("should extract requirements from an actual story file", async () => {
|
|
393
|
-
const storyPath = path.join(tempDir, "test-story.md");
|
|
394
|
-
const content = `
|
|
395
|
-
# Test Story
|
|
396
|
-
|
|
397
|
-
## Requirements
|
|
398
|
-
|
|
399
|
-
- **REQ-FILE-001**: First requirement
|
|
400
|
-
- **REQ-FILE-002**: Second requirement
|
|
401
|
-
`;
|
|
402
|
-
await fs.promises.writeFile(storyPath, content, "utf8");
|
|
403
|
-
const requirements = (0, storyParser_1.extractRequirementsFromStoryFile)(storyPath);
|
|
404
|
-
expect(requirements).toEqual(new Set(["REQ-FILE-001", "REQ-FILE-002"]));
|
|
405
|
-
});
|
|
406
|
-
/**
|
|
407
|
-
* Test error handling for non-existent file
|
|
408
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
409
|
-
* @req REQ-DEEP-PARSE - Handle file read errors gracefully
|
|
410
|
-
*/
|
|
411
|
-
it("should return empty set for non-existent file", () => {
|
|
412
|
-
const nonExistentPath = path.join(tempDir, "does-not-exist.md");
|
|
413
|
-
const requirements = (0, storyParser_1.extractRequirementsFromStoryFile)(nonExistentPath);
|
|
414
|
-
expect(requirements).toEqual(new Set());
|
|
415
|
-
});
|
|
416
|
-
/**
|
|
417
|
-
* Test error handling for invalid file path
|
|
418
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
419
|
-
* @req REQ-DEEP-PARSE - Handle file read errors gracefully
|
|
420
|
-
*/
|
|
421
|
-
it("should return empty set for invalid file path", () => {
|
|
422
|
-
const invalidPath = "/invalid/\x00/path.md";
|
|
423
|
-
const requirements = (0, storyParser_1.extractRequirementsFromStoryFile)(invalidPath);
|
|
424
|
-
expect(requirements).toEqual(new Set());
|
|
425
|
-
});
|
|
426
|
-
/**
|
|
427
|
-
* Test reading empty file
|
|
428
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
429
|
-
* @req REQ-DEEP-PARSE - Handle empty files
|
|
430
|
-
*/
|
|
431
|
-
it("should return empty set for empty file", async () => {
|
|
432
|
-
const emptyPath = path.join(tempDir, "empty.md");
|
|
433
|
-
await fs.promises.writeFile(emptyPath, "", "utf8");
|
|
434
|
-
const requirements = (0, storyParser_1.extractRequirementsFromStoryFile)(emptyPath);
|
|
435
|
-
expect(requirements).toEqual(new Set());
|
|
436
|
-
});
|
|
437
|
-
/**
|
|
438
|
-
* Test reading file with no requirements
|
|
439
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
440
|
-
* @req REQ-DEEP-PARSE - Handle files with no requirements
|
|
441
|
-
*/
|
|
442
|
-
it("should return empty set for file with no requirements", async () => {
|
|
443
|
-
const noReqPath = path.join(tempDir, "no-requirements.md");
|
|
444
|
-
const content = `
|
|
445
|
-
# Story without requirements
|
|
446
|
-
|
|
447
|
-
## Description
|
|
448
|
-
|
|
449
|
-
This story has no requirements.
|
|
450
|
-
`;
|
|
451
|
-
await fs.promises.writeFile(noReqPath, content, "utf8");
|
|
452
|
-
const requirements = (0, storyParser_1.extractRequirementsFromStoryFile)(noReqPath);
|
|
453
|
-
expect(requirements).toEqual(new Set());
|
|
454
|
-
});
|
|
455
|
-
/**
|
|
456
|
-
* Test file with UTF-8 encoding
|
|
457
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
458
|
-
* @req REQ-DEEP-PARSE - Handle files with UTF-8 encoding
|
|
459
|
-
*/
|
|
460
|
-
it("should handle UTF-8 encoded files", async () => {
|
|
461
|
-
const utf8Path = path.join(tempDir, "utf8-story.md");
|
|
462
|
-
const content = `
|
|
463
|
-
# Story with UTF-8 ✓
|
|
464
|
-
|
|
465
|
-
## Requirements
|
|
466
|
-
|
|
467
|
-
- **REQ-UTF8-001**: Requirement with emoji 🚀
|
|
468
|
-
- **REQ-UTF8-002**: Requirement with accents: café, naïve
|
|
469
|
-
`;
|
|
470
|
-
await fs.promises.writeFile(utf8Path, content, "utf8");
|
|
471
|
-
const requirements = (0, storyParser_1.extractRequirementsFromStoryFile)(utf8Path);
|
|
472
|
-
expect(requirements).toEqual(new Set(["REQ-UTF8-001", "REQ-UTF8-002"]));
|
|
473
|
-
});
|
|
474
|
-
/**
|
|
475
|
-
* Test file with Windows line endings
|
|
476
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
477
|
-
* @req REQ-DEEP-PARSE - Handle files with different line endings
|
|
478
|
-
*/
|
|
479
|
-
it("should handle files with Windows line endings (CRLF)", async () => {
|
|
480
|
-
const crlfPath = path.join(tempDir, "crlf-story.md");
|
|
481
|
-
const content = "## Requirements\r\n\r\n- **REQ-CRLF-001**: First\r\n- **REQ-CRLF-002**: Second\r\n";
|
|
482
|
-
await fs.promises.writeFile(crlfPath, content, "utf8");
|
|
483
|
-
const requirements = (0, storyParser_1.extractRequirementsFromStoryFile)(crlfPath);
|
|
484
|
-
expect(requirements).toEqual(new Set(["REQ-CRLF-001", "REQ-CRLF-002"]));
|
|
485
|
-
});
|
|
486
|
-
/**
|
|
487
|
-
* Test large file handling
|
|
488
|
-
* @story docs/stories/010.0-DEV-DEEP-VALIDATION.story.md
|
|
489
|
-
* @req REQ-DEEP-PARSE - Handle large story files efficiently
|
|
490
|
-
*/
|
|
491
|
-
it("should handle large files with many requirements", async () => {
|
|
492
|
-
const largePath = path.join(tempDir, "large-story.md");
|
|
493
|
-
let content = "# Large Story\n\n## Requirements\n\n";
|
|
494
|
-
// Generate 100 requirements
|
|
495
|
-
for (let i = 1; i <= 100; i++) {
|
|
496
|
-
content += `- **REQ-LARGE-${i.toString().padStart(3, "0")}**: Requirement ${i}\n`;
|
|
497
|
-
}
|
|
498
|
-
await fs.promises.writeFile(largePath, content, "utf8");
|
|
499
|
-
const requirements = (0, storyParser_1.extractRequirementsFromStoryFile)(largePath);
|
|
500
|
-
expect(requirements.size).toBe(100);
|
|
501
|
-
expect(requirements.has("REQ-LARGE-001")).toBe(true);
|
|
502
|
-
expect(requirements.has("REQ-LARGE-100")).toBe(true);
|
|
503
|
-
});
|
|
504
|
-
});
|
|
505
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,71 +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-UPDATE - Update annotation references
|
|
40
|
-
* @supports docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md REQ-MAINT-UPDATE
|
|
41
|
-
*/
|
|
42
|
-
const fs = __importStar(require("fs"));
|
|
43
|
-
const path = __importStar(require("path"));
|
|
44
|
-
const os = __importStar(require("os"));
|
|
45
|
-
const update_1 = require("../../src/maintenance/update");
|
|
46
|
-
describe("updateAnnotationReferences isolated (Story 009.0-DEV-MAINTENANCE-TOOLS)", () => {
|
|
47
|
-
it("[REQ-MAINT-UPDATE] updates @story annotations in files", () => {
|
|
48
|
-
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "tmp-"));
|
|
49
|
-
try {
|
|
50
|
-
const filePath = path.join(tmpDir, "file.ts");
|
|
51
|
-
const originalContent = `
|
|
52
|
-
/**
|
|
53
|
-
* @story old.path.md
|
|
54
|
-
*/
|
|
55
|
-
function foo() {}
|
|
56
|
-
`;
|
|
57
|
-
fs.writeFileSync(filePath, originalContent, "utf8");
|
|
58
|
-
const count = (0, update_1.updateAnnotationReferences)(tmpDir, "old.path.md", "new.path.md");
|
|
59
|
-
expect(count).toBe(1);
|
|
60
|
-
const updatedContent = fs.readFileSync(filePath, "utf8");
|
|
61
|
-
expect(updatedContent).toContain("@story new.path.md");
|
|
62
|
-
}
|
|
63
|
-
finally {
|
|
64
|
-
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
it("[REQ-MAINT-UPDATE] should return 0 when directory does not exist", () => {
|
|
68
|
-
const count = (0, update_1.updateAnnotationReferences)("non-existent-dir", "old.md", "new.md");
|
|
69
|
-
expect(count).toBe(0);
|
|
70
|
-
});
|
|
71
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,27 +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-UPDATE - Update annotation references
|
|
10
|
-
* @supports docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md REQ-MAINT-UPDATE
|
|
11
|
-
*/
|
|
12
|
-
const fs_1 = __importDefault(require("fs"));
|
|
13
|
-
const os_1 = __importDefault(require("os"));
|
|
14
|
-
const path_1 = __importDefault(require("path"));
|
|
15
|
-
const update_1 = require("../../src/maintenance/update");
|
|
16
|
-
describe("updateAnnotationReferences (Story 009.0-DEV-MAINTENANCE-TOOLS)", () => {
|
|
17
|
-
it("[REQ-MAINT-UPDATE] should return 0 when no updates made", () => {
|
|
18
|
-
const tmpDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), "update-test-"));
|
|
19
|
-
try {
|
|
20
|
-
const count = (0, update_1.updateAnnotationReferences)(tmpDir, "old.md", "new.md");
|
|
21
|
-
expect(count).toBe(0);
|
|
22
|
-
}
|
|
23
|
-
finally {
|
|
24
|
-
fs_1.default.rmSync(tmpDir, { recursive: true, force: true });
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|