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 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,358 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const reqAnnotationDetection_1 = require("../../src/utils/reqAnnotationDetection");
|
|
4
|
-
// Small helper to construct a minimal SourceCode-like object for the detection helpers.
|
|
5
|
-
function createMockSourceCode(options = {}) {
|
|
6
|
-
const { lines = null, text = "", commentsBefore = [] } = options;
|
|
7
|
-
return {
|
|
8
|
-
lines: lines ?? undefined,
|
|
9
|
-
getText() {
|
|
10
|
-
return text;
|
|
11
|
-
},
|
|
12
|
-
getCommentsBefore() {
|
|
13
|
-
return commentsBefore;
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
describe("reqAnnotationDetection advanced heuristics (Story 003.0-DEV-FUNCTION-ANNOTATIONS)", () => {
|
|
18
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] returns false when sourceCode is missing", () => {
|
|
19
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(null, [], undefined, {
|
|
20
|
-
loc: null,
|
|
21
|
-
});
|
|
22
|
-
expect(has).toBe(false);
|
|
23
|
-
});
|
|
24
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] returns false when node is missing", () => {
|
|
25
|
-
const context = {
|
|
26
|
-
getSourceCode() {
|
|
27
|
-
return createMockSourceCode({ lines: ["/** @req REQ-TEST */"] });
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(null, [], context, undefined);
|
|
31
|
-
expect(has).toBe(false);
|
|
32
|
-
});
|
|
33
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] inspects jsdoc and comments when advanced heuristics throw", () => {
|
|
34
|
-
const context = {
|
|
35
|
-
getSourceCode() {
|
|
36
|
-
// This object intentionally causes hasReqInAdvancedHeuristics to throw by
|
|
37
|
-
// providing a getCommentsBefore implementation that throws on access.
|
|
38
|
-
return {
|
|
39
|
-
getCommentsBefore() {
|
|
40
|
-
throw new Error("boom");
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
const jsdoc = { value: "/** @req REQ-FROM-JSDOC */" };
|
|
46
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(jsdoc, [], context, {
|
|
47
|
-
// Minimal shape – the helper will call into the mock sourceCode and trigger the throw
|
|
48
|
-
parent: {},
|
|
49
|
-
});
|
|
50
|
-
expect(has).toBe(true);
|
|
51
|
-
});
|
|
52
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] treats @supports in comments as satisfying requirement", () => {
|
|
53
|
-
const context = {
|
|
54
|
-
getSourceCode() {
|
|
55
|
-
return createMockSourceCode();
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
const comments = [{ value: "// @supports docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md REQ-X" }];
|
|
59
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(null, comments, context, {
|
|
60
|
-
parent: {},
|
|
61
|
-
});
|
|
62
|
-
expect(has).toBe(true);
|
|
63
|
-
});
|
|
64
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] linesBeforeHasReq returns false when lines is not an array", () => {
|
|
65
|
-
const context = {
|
|
66
|
-
getSourceCode() {
|
|
67
|
-
// lines is null here, causing the helper to see a non-array and return false
|
|
68
|
-
return createMockSourceCode({ lines: null });
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(null, [], context, {
|
|
72
|
-
// Provide a minimal location so advanced heuristics try to use line info
|
|
73
|
-
loc: { start: { line: 5 } },
|
|
74
|
-
parent: {},
|
|
75
|
-
});
|
|
76
|
-
expect(has).toBe(false);
|
|
77
|
-
});
|
|
78
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] linesBeforeHasReq returns false when startLine is not a number", () => {
|
|
79
|
-
const sourceCode = createMockSourceCode({ lines: ["// @req REQ-SHOULD-NOT-BE-SEEN"] });
|
|
80
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(null, [], { getSourceCode: () => sourceCode }, {
|
|
81
|
-
// loc is missing/undefined; startLine will not be a valid number
|
|
82
|
-
loc: undefined,
|
|
83
|
-
parent: {},
|
|
84
|
-
});
|
|
85
|
-
expect(has).toBe(false);
|
|
86
|
-
});
|
|
87
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] parentChainHasReq returns false when getCommentsBefore is not a function and no leadingComments/parents have req", () => {
|
|
88
|
-
const context = {
|
|
89
|
-
getSourceCode() {
|
|
90
|
-
return {
|
|
91
|
-
// getCommentsBefore is not a function here
|
|
92
|
-
getCommentsBefore: 123,
|
|
93
|
-
};
|
|
94
|
-
},
|
|
95
|
-
};
|
|
96
|
-
const node = {
|
|
97
|
-
parent: {
|
|
98
|
-
leadingComments: [{ value: "no req here" }],
|
|
99
|
-
parent: {
|
|
100
|
-
leadingComments: [{ value: "still nothing" }],
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(null, [], context, node);
|
|
105
|
-
expect(has).toBe(false);
|
|
106
|
-
});
|
|
107
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] parentChainHasReq returns true when getCommentsBefore returns comments containing @req", () => {
|
|
108
|
-
const sourceCode = {
|
|
109
|
-
getCommentsBefore(n) {
|
|
110
|
-
if (n && n.isTargetParent) {
|
|
111
|
-
return [{ value: "/* @req REQ-FROM-PARENT */" }];
|
|
112
|
-
}
|
|
113
|
-
return [];
|
|
114
|
-
},
|
|
115
|
-
};
|
|
116
|
-
const context = {
|
|
117
|
-
getSourceCode() {
|
|
118
|
-
return sourceCode;
|
|
119
|
-
},
|
|
120
|
-
};
|
|
121
|
-
const node = {
|
|
122
|
-
parent: {
|
|
123
|
-
isTargetParent: true,
|
|
124
|
-
parent: {},
|
|
125
|
-
},
|
|
126
|
-
};
|
|
127
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(null, [], context, node);
|
|
128
|
-
expect(has).toBe(true);
|
|
129
|
-
});
|
|
130
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] fallbackTextBeforeHasReq returns false when getText is not a function", () => {
|
|
131
|
-
const context = {
|
|
132
|
-
getSourceCode() {
|
|
133
|
-
return {
|
|
134
|
-
// getText is not a function
|
|
135
|
-
getText: "not-a-function",
|
|
136
|
-
};
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
const node = {
|
|
140
|
-
range: [0, 10],
|
|
141
|
-
parent: {},
|
|
142
|
-
};
|
|
143
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(null, [], context, node);
|
|
144
|
-
expect(has).toBe(false);
|
|
145
|
-
});
|
|
146
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] fallbackTextBeforeHasReq returns false when node.range is not an array", () => {
|
|
147
|
-
const context = {
|
|
148
|
-
getSourceCode() {
|
|
149
|
-
return createMockSourceCode({ text: "/* @req REQ-IN-TEXT */" });
|
|
150
|
-
},
|
|
151
|
-
};
|
|
152
|
-
const node = {
|
|
153
|
-
// range is missing; helper should see non-array range and return false
|
|
154
|
-
range: null,
|
|
155
|
-
parent: {},
|
|
156
|
-
};
|
|
157
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(null, [], context, node);
|
|
158
|
-
expect(has).toBe(false);
|
|
159
|
-
});
|
|
160
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] fallbackTextBeforeHasReq returns false when range[0] is not a number", () => {
|
|
161
|
-
const context = {
|
|
162
|
-
getSourceCode() {
|
|
163
|
-
return createMockSourceCode({ text: "/* @req REQ-IN-TEXT-BUT-INVALID-RANGE */" });
|
|
164
|
-
},
|
|
165
|
-
};
|
|
166
|
-
const node = {
|
|
167
|
-
// First element of range is not a number; guard on numeric start index should trigger
|
|
168
|
-
range: ["not-a-number", 10],
|
|
169
|
-
parent: {},
|
|
170
|
-
};
|
|
171
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(null, [], context, node);
|
|
172
|
-
expect(has).toBe(false);
|
|
173
|
-
});
|
|
174
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] fallbackTextBeforeHasReq returns true when text window contains @req", () => {
|
|
175
|
-
const fullText = `
|
|
176
|
-
// some header
|
|
177
|
-
/** @req REQ-IN-TEXT-WINDOW */
|
|
178
|
-
function foo() {}
|
|
179
|
-
`;
|
|
180
|
-
const context = {
|
|
181
|
-
getSourceCode() {
|
|
182
|
-
return createMockSourceCode({ text: fullText });
|
|
183
|
-
},
|
|
184
|
-
};
|
|
185
|
-
// Choose a range that starts after the @req comment so the "text before"
|
|
186
|
-
// window that the helper inspects includes the annotation.
|
|
187
|
-
const startIndex = fullText.indexOf("function foo");
|
|
188
|
-
const node = {
|
|
189
|
-
range: [startIndex, startIndex + 5],
|
|
190
|
-
parent: {},
|
|
191
|
-
};
|
|
192
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(null, [], context, node);
|
|
193
|
-
expect(has).toBe(true);
|
|
194
|
-
});
|
|
195
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] fallbackTextBeforeHasReq returns false when getText throws", () => {
|
|
196
|
-
const context = {
|
|
197
|
-
getSourceCode() {
|
|
198
|
-
return {
|
|
199
|
-
getText() {
|
|
200
|
-
throw new Error("boom from getText");
|
|
201
|
-
},
|
|
202
|
-
};
|
|
203
|
-
},
|
|
204
|
-
};
|
|
205
|
-
const node = {
|
|
206
|
-
range: [0, 10],
|
|
207
|
-
parent: {},
|
|
208
|
-
};
|
|
209
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(null, [], context, node);
|
|
210
|
-
expect(has).toBe(false);
|
|
211
|
-
});
|
|
212
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] hasReqInAdvancedHeuristics short-circuits and returns false when sourceCode is missing", () => {
|
|
213
|
-
const context = {
|
|
214
|
-
// No getSourceCode method at all – internal advanced heuristics
|
|
215
|
-
// should immediately return false and not throw.
|
|
216
|
-
};
|
|
217
|
-
const node = {
|
|
218
|
-
loc: { start: { line: 3 } },
|
|
219
|
-
range: [0, 10],
|
|
220
|
-
parent: {},
|
|
221
|
-
};
|
|
222
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(null, [], context, node);
|
|
223
|
-
expect(has).toBe(false);
|
|
224
|
-
});
|
|
225
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] hasReqInAdvancedHeuristics short-circuits and returns false when node is missing", () => {
|
|
226
|
-
const context = {
|
|
227
|
-
getSourceCode() {
|
|
228
|
-
return createMockSourceCode({ text: "@req REQ-SHOULD-NOT-BE-SEEN" });
|
|
229
|
-
},
|
|
230
|
-
};
|
|
231
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(null, [], context, undefined);
|
|
232
|
-
expect(has).toBe(false);
|
|
233
|
-
});
|
|
234
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] hasReqAnnotation returns true when jsdoc contains @supports and advanced heuristics are false", () => {
|
|
235
|
-
const context = {
|
|
236
|
-
getSourceCode() {
|
|
237
|
-
// Returning a sourceCode that will not satisfy any advanced heuristic
|
|
238
|
-
// (no lines, no comments, empty text).
|
|
239
|
-
return createMockSourceCode({ lines: [], text: "" });
|
|
240
|
-
},
|
|
241
|
-
};
|
|
242
|
-
const jsdoc = {
|
|
243
|
-
value: "/** @supports docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md REQ-JSDOC-SUPPORTS */",
|
|
244
|
-
};
|
|
245
|
-
const node = {
|
|
246
|
-
parent: {},
|
|
247
|
-
};
|
|
248
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(jsdoc, [], context, node);
|
|
249
|
-
expect(has).toBe(true);
|
|
250
|
-
});
|
|
251
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] falls back to jsdoc/comments when context.getSourceCode throws", () => {
|
|
252
|
-
const context = {
|
|
253
|
-
getSourceCode() {
|
|
254
|
-
throw new Error("boom from getSourceCode");
|
|
255
|
-
},
|
|
256
|
-
};
|
|
257
|
-
const jsdoc = { value: "/** @req REQ-FROM-GETSOURCECODE */" };
|
|
258
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(jsdoc, [], context, { parent: {} });
|
|
259
|
-
expect(has).toBe(true);
|
|
260
|
-
});
|
|
261
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] linesBeforeHasReq returns true when preceding lines contain @req marker", () => {
|
|
262
|
-
const context = {
|
|
263
|
-
getSourceCode() {
|
|
264
|
-
return createMockSourceCode({
|
|
265
|
-
lines: [
|
|
266
|
-
"// some header",
|
|
267
|
-
"/** @req REQ-LINE-BEFORE */",
|
|
268
|
-
"function foo() {}",
|
|
269
|
-
],
|
|
270
|
-
});
|
|
271
|
-
},
|
|
272
|
-
};
|
|
273
|
-
const node = {
|
|
274
|
-
// Node starts on line 3 (1-based), so line 2 is inspected by linesBeforeHasReq
|
|
275
|
-
loc: { start: { line: 3 } },
|
|
276
|
-
parent: {},
|
|
277
|
-
};
|
|
278
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(null, [], context, node);
|
|
279
|
-
expect(has).toBe(true);
|
|
280
|
-
});
|
|
281
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] parentChainHasReq returns true when leadingComments contain @supports and getCommentsBefore is unusable", () => {
|
|
282
|
-
const context = {
|
|
283
|
-
getSourceCode() {
|
|
284
|
-
return {
|
|
285
|
-
// Not a callable function; forces parentChainHasReq to rely on leadingComments
|
|
286
|
-
getCommentsBefore: 42,
|
|
287
|
-
};
|
|
288
|
-
},
|
|
289
|
-
};
|
|
290
|
-
const node = {
|
|
291
|
-
parent: {
|
|
292
|
-
leadingComments: [
|
|
293
|
-
{ value: "some other comment" },
|
|
294
|
-
{
|
|
295
|
-
value: "@supports docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md REQ-FROM-LEADING-COMMENT",
|
|
296
|
-
},
|
|
297
|
-
],
|
|
298
|
-
parent: {},
|
|
299
|
-
},
|
|
300
|
-
};
|
|
301
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(null, [], context, node);
|
|
302
|
-
expect(has).toBe(true);
|
|
303
|
-
});
|
|
304
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] returns true when jsdoc has @req even if context is undefined", () => {
|
|
305
|
-
const jsdoc = { value: "/** @req REQ-JSDOC-NO-CONTEXT */" };
|
|
306
|
-
const node = {
|
|
307
|
-
parent: {},
|
|
308
|
-
};
|
|
309
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(jsdoc, [], undefined, node);
|
|
310
|
-
expect(has).toBe(true);
|
|
311
|
-
});
|
|
312
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] hasReqAnnotation returns true when advanced heuristics find req via linesBeforeHasReq", () => {
|
|
313
|
-
const context = {
|
|
314
|
-
getSourceCode() {
|
|
315
|
-
return createMockSourceCode({
|
|
316
|
-
lines: [
|
|
317
|
-
"// header without req",
|
|
318
|
-
"/** @req REQ-ADV-LINES */",
|
|
319
|
-
"function bar() {}",
|
|
320
|
-
],
|
|
321
|
-
});
|
|
322
|
-
},
|
|
323
|
-
};
|
|
324
|
-
const node = {
|
|
325
|
-
loc: { start: { line: 3 } },
|
|
326
|
-
parent: {},
|
|
327
|
-
};
|
|
328
|
-
const jsdoc = { value: "/** no req here */" };
|
|
329
|
-
const comments = [{ value: "no req or supports here" }];
|
|
330
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(jsdoc, comments, context, node);
|
|
331
|
-
expect(has).toBe(true);
|
|
332
|
-
});
|
|
333
|
-
it("[REQ-ANNOTATION-REQ-DETECTION] hasReqAnnotation returns true when advanced heuristics find req via parentChainHasReq", () => {
|
|
334
|
-
const sourceCode = {
|
|
335
|
-
getCommentsBefore(n) {
|
|
336
|
-
if (n && n.isReqParent) {
|
|
337
|
-
return [{ value: "/* @req REQ-ADV-PARENT */" }];
|
|
338
|
-
}
|
|
339
|
-
return [{ value: "no req here" }];
|
|
340
|
-
},
|
|
341
|
-
};
|
|
342
|
-
const context = {
|
|
343
|
-
getSourceCode() {
|
|
344
|
-
return sourceCode;
|
|
345
|
-
},
|
|
346
|
-
};
|
|
347
|
-
const node = {
|
|
348
|
-
parent: {
|
|
349
|
-
isReqParent: true,
|
|
350
|
-
parent: {},
|
|
351
|
-
},
|
|
352
|
-
};
|
|
353
|
-
const jsdoc = { value: "/** jsdoc without requirement */" };
|
|
354
|
-
const comments = [{ value: "comment without requirement" }];
|
|
355
|
-
const has = (0, reqAnnotationDetection_1.hasReqAnnotation)(jsdoc, comments, context, node);
|
|
356
|
-
expect(has).toBe(true);
|
|
357
|
-
});
|
|
358
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared test helpers for require-story-core branch coverage.
|
|
3
|
-
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
4
|
-
* @req REQ-AUTOFIX - Provide reusable helpers to exercise autofix branches
|
|
5
|
-
*/
|
|
6
|
-
interface ExerciseOptions {
|
|
7
|
-
annotationText?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare function exerciseCreateAddStoryFixBranches(createAddStoryFixFactory: (_target: any, _annotationTemplate: string) => (_fixer: any) => any, options?: ExerciseOptions): void;
|
|
10
|
-
export {};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Shared test helpers for require-story-core branch coverage.
|
|
4
|
-
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
5
|
-
* @req REQ-AUTOFIX - Provide reusable helpers to exercise autofix branches
|
|
6
|
-
*/
|
|
7
|
-
/* global jest, expect */
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.exerciseCreateAddStoryFixBranches = exerciseCreateAddStoryFixBranches;
|
|
10
|
-
const RANGE_ONE_START = 21;
|
|
11
|
-
const RANGE_ONE_END = 33;
|
|
12
|
-
const RANGE_TWO_START = 50;
|
|
13
|
-
const RANGE_TWO_END = 70;
|
|
14
|
-
const RANGE_PARENT_START = 5;
|
|
15
|
-
const RANGE_PARENT_END = 100;
|
|
16
|
-
const DEFAULT_ANNOTATION = "/** @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md */\n";
|
|
17
|
-
function baseFixer() {
|
|
18
|
-
return {
|
|
19
|
-
insertTextBeforeRange: jest.fn((r, t) => ({ r, t })),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function exerciseBranch1(createAddStoryFixFactory, annotation) {
|
|
23
|
-
const fixer = baseFixer();
|
|
24
|
-
const fixFn = createAddStoryFixFactory(null, annotation);
|
|
25
|
-
const res = fixFn(fixer);
|
|
26
|
-
expect(fixer.insertTextBeforeRange).toHaveBeenCalledTimes(1);
|
|
27
|
-
const args = fixer.insertTextBeforeRange.mock.calls[0];
|
|
28
|
-
expect(args[0]).toEqual([0, 0]);
|
|
29
|
-
expect(args[1]).toBe(`${annotation}\n`);
|
|
30
|
-
expect(res).toEqual({
|
|
31
|
-
r: [0, 0],
|
|
32
|
-
t: `${annotation}\n`,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
function exerciseBranch2(createAddStoryFixFactory, annotation) {
|
|
36
|
-
const target = {
|
|
37
|
-
type: "FunctionDeclaration",
|
|
38
|
-
range: [RANGE_ONE_START, RANGE_ONE_END],
|
|
39
|
-
parent: { type: "ClassBody" },
|
|
40
|
-
};
|
|
41
|
-
const fixer = baseFixer();
|
|
42
|
-
const fixFn = createAddStoryFixFactory(target, annotation);
|
|
43
|
-
const res = fixFn(fixer);
|
|
44
|
-
expect(fixer.insertTextBeforeRange.mock.calls[0][0]).toEqual([RANGE_ONE_START, RANGE_ONE_START]);
|
|
45
|
-
expect(fixer.insertTextBeforeRange.mock.calls[0][1]).toBe(`${annotation}\n`);
|
|
46
|
-
expect(res).toEqual({
|
|
47
|
-
r: [RANGE_ONE_START, RANGE_ONE_START],
|
|
48
|
-
t: `${annotation}\n`,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
function exerciseBranch3(createAddStoryFixFactory, annotation) {
|
|
52
|
-
const target = {
|
|
53
|
-
type: "FunctionDeclaration",
|
|
54
|
-
range: [RANGE_TWO_START, RANGE_TWO_END],
|
|
55
|
-
parent: {
|
|
56
|
-
type: "ExportDefaultDeclaration",
|
|
57
|
-
range: [RANGE_PARENT_START, RANGE_PARENT_END],
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
const fixer = baseFixer();
|
|
61
|
-
const fixFn = createAddStoryFixFactory(target, annotation);
|
|
62
|
-
const res = fixFn(fixer);
|
|
63
|
-
expect(fixer.insertTextBeforeRange.mock.calls[0][0]).toEqual([RANGE_PARENT_START, RANGE_PARENT_START]);
|
|
64
|
-
expect(fixer.insertTextBeforeRange.mock.calls[0][1]).toBe(`${annotation}\n`);
|
|
65
|
-
expect(res).toEqual({
|
|
66
|
-
r: [RANGE_PARENT_START, RANGE_PARENT_START],
|
|
67
|
-
t: `${annotation}\n`,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
function exerciseCreateAddStoryFixBranches(createAddStoryFixFactory, options = {}) {
|
|
71
|
-
const annotation = options.annotationText ?? DEFAULT_ANNOTATION;
|
|
72
|
-
exerciseBranch1(createAddStoryFixFactory, annotation);
|
|
73
|
-
exerciseBranch2(createAddStoryFixFactory, annotation);
|
|
74
|
-
exerciseBranch3(createAddStoryFixFactory, annotation);
|
|
75
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export interface TempDirHandle {
|
|
2
|
-
/** The absolute path to the created temporary directory. */
|
|
3
|
-
readonly dir: string;
|
|
4
|
-
/**
|
|
5
|
-
* Remove the directory recursively; safe to call multiple times.
|
|
6
|
-
* @supports docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md REQ-MAINT-SAFE
|
|
7
|
-
*/
|
|
8
|
-
cleanup(): void;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Create a temporary directory under the OS temp root with a common prefix.
|
|
12
|
-
*
|
|
13
|
-
* This helper centralizes the mkdtemp + rmSync pattern that appears in
|
|
14
|
-
* multiple maintenance tests so those tests can focus on behavior instead
|
|
15
|
-
* of filesystem plumbing.
|
|
16
|
-
*
|
|
17
|
-
* @supports docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md REQ-MAINT-TEMP-HELPERS REQ-MAINT-SAFE
|
|
18
|
-
*/
|
|
19
|
-
export declare function createTempDir(prefix: string): TempDirHandle;
|
|
@@ -1,62 +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
|
-
exports.createTempDir = createTempDir;
|
|
37
|
-
/**
|
|
38
|
-
* Shared temp directory helpers for maintenance tests.
|
|
39
|
-
* @story docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
|
|
40
|
-
* @req REQ-MAINT-TEMP-HELPERS - Provide reusable OS tempdir setup/cleanup utilities for tests
|
|
41
|
-
*/
|
|
42
|
-
const fs = __importStar(require("fs"));
|
|
43
|
-
const os = __importStar(require("os"));
|
|
44
|
-
const path = __importStar(require("path"));
|
|
45
|
-
/**
|
|
46
|
-
* Create a temporary directory under the OS temp root with a common prefix.
|
|
47
|
-
*
|
|
48
|
-
* This helper centralizes the mkdtemp + rmSync pattern that appears in
|
|
49
|
-
* multiple maintenance tests so those tests can focus on behavior instead
|
|
50
|
-
* of filesystem plumbing.
|
|
51
|
-
*
|
|
52
|
-
* @supports docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md REQ-MAINT-TEMP-HELPERS REQ-MAINT-SAFE
|
|
53
|
-
*/
|
|
54
|
-
function createTempDir(prefix) {
|
|
55
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), prefix));
|
|
56
|
-
return {
|
|
57
|
-
dir,
|
|
58
|
-
cleanup() {
|
|
59
|
-
fs.rmSync(dir, { recursive: true, force: true });
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared TypeScript RuleTester language options for traceability tests.
|
|
3
|
-
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
4
|
-
* @req REQ-TYPESCRIPT-SUPPORT - Provide reusable TypeScript parser setup for tests
|
|
5
|
-
*/
|
|
6
|
-
export declare const tsRuleTesterLanguageOptions: any;
|
|
7
|
-
/**
|
|
8
|
-
* Attach shared TypeScript RuleTester language options to a test case definition.
|
|
9
|
-
* This helper allows tests to avoid repeating the languageOptions assignment.
|
|
10
|
-
*
|
|
11
|
-
* @param testCase A RuleTester valid/invalid test case object
|
|
12
|
-
* @returns The same test case with TypeScript language options applied
|
|
13
|
-
*/
|
|
14
|
-
export declare function withTsLanguageOptions<T extends Record<string, unknown>>(testCase: T): T & {
|
|
15
|
-
languageOptions: typeof tsRuleTesterLanguageOptions;
|
|
16
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Shared TypeScript RuleTester language options for traceability tests.
|
|
4
|
-
* @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
|
|
5
|
-
* @req REQ-TYPESCRIPT-SUPPORT - Provide reusable TypeScript parser setup for tests
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.tsRuleTesterLanguageOptions = void 0;
|
|
9
|
-
exports.withTsLanguageOptions = withTsLanguageOptions;
|
|
10
|
-
const tsEcmaVersion = 2022;
|
|
11
|
-
exports.tsRuleTesterLanguageOptions = {
|
|
12
|
-
parser: require("@typescript-eslint/parser"),
|
|
13
|
-
parserOptions: {
|
|
14
|
-
ecmaVersion: tsEcmaVersion,
|
|
15
|
-
sourceType: "module",
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Attach shared TypeScript RuleTester language options to a test case definition.
|
|
20
|
-
* This helper allows tests to avoid repeating the languageOptions assignment.
|
|
21
|
-
*
|
|
22
|
-
* @param testCase A RuleTester valid/invalid test case object
|
|
23
|
-
* @returns The same test case with TypeScript language options applied
|
|
24
|
-
*/
|
|
25
|
-
function withTsLanguageOptions(testCase) {
|
|
26
|
-
return {
|
|
27
|
-
...testCase,
|
|
28
|
-
languageOptions: exports.tsRuleTesterLanguageOptions,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|