eslint-plugin-traceability 1.23.0 → 1.24.0
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 +2 -2
- package/lib/{src/rules → rules}/require-traceability.js +49 -4
- package/package.json +8 -8
- package/user-docs/api-reference.md +25 -0
- 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}/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,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 {};
|