@nokout/big-dill-core 0.0.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/LICENSE +21 -0
- package/README.md +202 -0
- package/dist/completion/complete.d.ts +40 -0
- package/dist/completion/complete.d.ts.map +1 -0
- package/dist/completion/complete.js +134 -0
- package/dist/completion/complete.js.map +1 -0
- package/dist/format/tables.d.ts +7 -0
- package/dist/format/tables.d.ts.map +1 -0
- package/dist/format/tables.js +87 -0
- package/dist/format/tables.js.map +1 -0
- package/dist/gherkin/parser.d.ts +28 -0
- package/dist/gherkin/parser.d.ts.map +1 -0
- package/dist/gherkin/parser.js +44 -0
- package/dist/gherkin/parser.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +92 -0
- package/dist/index.js.map +1 -0
- package/dist/ipc/server.d.ts +13 -0
- package/dist/ipc/server.d.ts.map +1 -0
- package/dist/ipc/server.js +106 -0
- package/dist/ipc/server.js.map +1 -0
- package/dist/lint/rules.d.ts +46 -0
- package/dist/lint/rules.d.ts.map +1 -0
- package/dist/lint/rules.js +387 -0
- package/dist/lint/rules.js.map +1 -0
- package/dist/protocol/types.d.ts +97 -0
- package/dist/protocol/types.d.ts.map +1 -0
- package/dist/protocol/types.js +5 -0
- package/dist/protocol/types.js.map +1 -0
- package/dist/pytest/runner.d.ts +29 -0
- package/dist/pytest/runner.d.ts.map +1 -0
- package/dist/pytest/runner.js +225 -0
- package/dist/pytest/runner.js.map +1 -0
- package/dist/results/outcomes.d.ts +36 -0
- package/dist/results/outcomes.d.ts.map +1 -0
- package/dist/results/outcomes.js +69 -0
- package/dist/results/outcomes.js.map +1 -0
- package/dist/steps/browser.d.ts +42 -0
- package/dist/steps/browser.d.ts.map +1 -0
- package/dist/steps/browser.js +110 -0
- package/dist/steps/browser.js.map +1 -0
- package/dist/steps/documentation.d.ts +10 -0
- package/dist/steps/documentation.d.ts.map +1 -0
- package/dist/steps/documentation.js +39 -0
- package/dist/steps/documentation.js.map +1 -0
- package/dist/steps/references.d.ts +10 -0
- package/dist/steps/references.d.ts.map +1 -0
- package/dist/steps/references.js +34 -0
- package/dist/steps/references.js.map +1 -0
- package/dist/steps/stepCache.d.ts +50 -0
- package/dist/steps/stepCache.d.ts.map +1 -0
- package/dist/steps/stepCache.js +149 -0
- package/dist/steps/stepCache.js.map +1 -0
- package/dist/steps/stubs.d.ts +10 -0
- package/dist/steps/stubs.d.ts.map +1 -0
- package/dist/steps/stubs.js +46 -0
- package/dist/steps/stubs.js.map +1 -0
- package/dist/steps/unimplemented.d.ts +10 -0
- package/dist/steps/unimplemented.d.ts.map +1 -0
- package/dist/steps/unimplemented.js +26 -0
- package/dist/steps/unimplemented.js.map +1 -0
- package/dist/symbols/outline.d.ts +13 -0
- package/dist/symbols/outline.d.ts.map +1 -0
- package/dist/symbols/outline.js +38 -0
- package/dist/symbols/outline.js.map +1 -0
- package/dist/tokens/semanticTokens.d.ts +13 -0
- package/dist/tokens/semanticTokens.d.ts.map +1 -0
- package/dist/tokens/semanticTokens.js +77 -0
- package/dist/tokens/semanticTokens.js.map +1 -0
- package/dist/tree/builder.d.ts +40 -0
- package/dist/tree/builder.d.ts.map +1 -0
- package/dist/tree/builder.js +178 -0
- package/dist/tree/builder.js.map +1 -0
- package/package.json +58 -0
- package/src/completion/complete.ts +165 -0
- package/src/format/tables.ts +108 -0
- package/src/gherkin/parser.ts +69 -0
- package/src/index.ts +136 -0
- package/src/ipc/server.ts +84 -0
- package/src/lint/rules.ts +425 -0
- package/src/protocol/types.ts +114 -0
- package/src/pytest/runner.ts +249 -0
- package/src/results/outcomes.ts +102 -0
- package/src/steps/browser.ts +105 -0
- package/src/steps/documentation.ts +43 -0
- package/src/steps/references.ts +33 -0
- package/src/steps/stepCache.ts +168 -0
- package/src/steps/stubs.ts +48 -0
- package/src/steps/unimplemented.ts +31 -0
- package/src/symbols/outline.ts +52 -0
- package/src/tokens/semanticTokens.ts +98 -0
- package/src/tree/builder.ts +187 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { StepDefinition, StepParameter } from '../protocol/types';
|
|
2
|
+
export type LineMatch = {
|
|
3
|
+
step: StepDefinition;
|
|
4
|
+
params: Record<string, string>;
|
|
5
|
+
};
|
|
6
|
+
export type ParamAtPosition = {
|
|
7
|
+
parameter: StepParameter;
|
|
8
|
+
valueStart: number;
|
|
9
|
+
valueEnd: number;
|
|
10
|
+
};
|
|
11
|
+
/** Convert a step pattern to a regex with named capture groups for each parameter. */
|
|
12
|
+
/**
|
|
13
|
+
* Convert a step pattern to an anchored regex with a named capture per parameter.
|
|
14
|
+
*
|
|
15
|
+
* Exported because reference-finding needs the identical conversion; a second
|
|
16
|
+
* copy of this drifted once already (it missed the bounded-quantifier fix for
|
|
17
|
+
* ReDoS), so there is deliberately only one.
|
|
18
|
+
*/
|
|
19
|
+
export declare function patternToRegex(pattern: string): RegExp;
|
|
20
|
+
export declare class StepCache {
|
|
21
|
+
private steps;
|
|
22
|
+
private distributedSteps;
|
|
23
|
+
update(steps: StepDefinition[]): void;
|
|
24
|
+
updateDistributed(steps: StepDefinition[]): void;
|
|
25
|
+
/**
|
|
26
|
+
* Scan *lines* (raw text lines from .feature files) and set `usage_count`
|
|
27
|
+
* on each step in the cache to the number of times that step pattern matches.
|
|
28
|
+
* Resets all counts to 0 before counting.
|
|
29
|
+
*/
|
|
30
|
+
updateUsageCounts(lines: string[]): void;
|
|
31
|
+
getAll(): StepDefinition[];
|
|
32
|
+
getForKeyword(keyword: string): StepDefinition[];
|
|
33
|
+
/** Match full step text (no keyword prefix) against cached patterns. */
|
|
34
|
+
matchLine(stepText: string): LineMatch | null;
|
|
35
|
+
/**
|
|
36
|
+
* Return the step definition whose pattern matches *stepText* (no keyword prefix),
|
|
37
|
+
* or null if no pattern matches. Used by hover, definition, and linting.
|
|
38
|
+
*/
|
|
39
|
+
matchPattern(stepText: string): StepDefinition | null;
|
|
40
|
+
/**
|
|
41
|
+
* Return the parameter the cursor (at *column*) sits inside on *lineText*,
|
|
42
|
+
* or null if the cursor is not inside a parameter value.
|
|
43
|
+
*
|
|
44
|
+
* Positions are computed by walking literal segment lengths so that a
|
|
45
|
+
* placeholder value that also appears in the literal prefix (e.g. "state"
|
|
46
|
+
* in "the state is {state:AustralianState}") resolves to the correct span.
|
|
47
|
+
*/
|
|
48
|
+
paramPositionAt(lineText: string, column: number): ParamAtPosition | null;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=stepCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepCache.d.ts","sourceRoot":"","sources":["../../src/steps/stepCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElE,MAAM,MAAM,SAAS,GAAG;IACpB,IAAI,EAAE,cAAc,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC1B,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,sFAAsF;AACtF;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAetD;AASD,qBAAa,SAAS;IAClB,OAAO,CAAC,KAAK,CAAwB;IACrC,OAAO,CAAC,gBAAgB,CAAwB;IAEhD,MAAM,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI;IAIrC,iBAAiB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI;IAIhD;;;;OAIG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAsBxC,MAAM,IAAI,cAAc,EAAE;IAI1B,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,EAAE;IAOhD,wEAAwE;IACxE,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAW7C;;;OAGG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IAWrD;;;;;;;OAOG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI;CAqC5E"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StepCache = void 0;
|
|
4
|
+
exports.patternToRegex = patternToRegex;
|
|
5
|
+
/** Convert a step pattern to a regex with named capture groups for each parameter. */
|
|
6
|
+
/**
|
|
7
|
+
* Convert a step pattern to an anchored regex with a named capture per parameter.
|
|
8
|
+
*
|
|
9
|
+
* Exported because reference-finding needs the identical conversion; a second
|
|
10
|
+
* copy of this drifted once already (it missed the bounded-quantifier fix for
|
|
11
|
+
* ReDoS), so there is deliberately only one.
|
|
12
|
+
*/
|
|
13
|
+
function patternToRegex(pattern) {
|
|
14
|
+
// Escape regex metacharacters except our own {} placeholders
|
|
15
|
+
const parts = pattern.split(/(\{[^}]{1,200}\})/);
|
|
16
|
+
const regexStr = parts
|
|
17
|
+
.map((part, i) => {
|
|
18
|
+
if (i % 2 === 1) {
|
|
19
|
+
// parameter placeholder — extract name, create named capture group
|
|
20
|
+
const name = part.replace(/^\{(\w+)(?::[^}]{1,200})?\}$/, '$1');
|
|
21
|
+
return `(?<${name}>.+?)`;
|
|
22
|
+
}
|
|
23
|
+
// literal text — escape regex metacharacters
|
|
24
|
+
return part.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
25
|
+
})
|
|
26
|
+
.join('');
|
|
27
|
+
return new RegExp(`^${regexStr}$`);
|
|
28
|
+
}
|
|
29
|
+
/** Strip Gherkin keyword prefix from a raw feature file step line. */
|
|
30
|
+
const KEYWORD_RE = /^\s*(?:Given|When|Then|And|But|\*)\s+/i;
|
|
31
|
+
function stripKeyword(line) {
|
|
32
|
+
const m = KEYWORD_RE.exec(line);
|
|
33
|
+
return m ? line.slice(m[0].length) : null;
|
|
34
|
+
}
|
|
35
|
+
class StepCache {
|
|
36
|
+
constructor() {
|
|
37
|
+
this.steps = [];
|
|
38
|
+
this.distributedSteps = [];
|
|
39
|
+
}
|
|
40
|
+
update(steps) {
|
|
41
|
+
this.steps = steps.map(s => ({ ...s, usage_count: s.usage_count ?? 0 }));
|
|
42
|
+
}
|
|
43
|
+
updateDistributed(steps) {
|
|
44
|
+
this.distributedSteps = steps.map(s => ({ ...s, usage_count: s.usage_count ?? 0 }));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Scan *lines* (raw text lines from .feature files) and set `usage_count`
|
|
48
|
+
* on each step in the cache to the number of times that step pattern matches.
|
|
49
|
+
* Resets all counts to 0 before counting.
|
|
50
|
+
*/
|
|
51
|
+
updateUsageCounts(lines) {
|
|
52
|
+
// Reset
|
|
53
|
+
for (const s of [...this.steps, ...this.distributedSteps]) {
|
|
54
|
+
s.usage_count = 0;
|
|
55
|
+
}
|
|
56
|
+
// Precompile one regex per step (not per line)
|
|
57
|
+
const allSteps = [...this.steps, ...this.distributedSteps];
|
|
58
|
+
const compiled = allSteps.map(s => ({ step: s, rx: patternToRegex(s.pattern) }));
|
|
59
|
+
for (const line of lines) {
|
|
60
|
+
const stepText = stripKeyword(line);
|
|
61
|
+
if (!stepText)
|
|
62
|
+
continue;
|
|
63
|
+
const trimmed = stepText.trim();
|
|
64
|
+
for (const { step, rx } of compiled) {
|
|
65
|
+
if (rx.test(trimmed)) {
|
|
66
|
+
step.usage_count = (step.usage_count ?? 0) + 1;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
getAll() {
|
|
72
|
+
return [...this.distributedSteps, ...this.steps];
|
|
73
|
+
}
|
|
74
|
+
getForKeyword(keyword) {
|
|
75
|
+
const norm = keyword.toLowerCase();
|
|
76
|
+
return this.getAll().filter((s) => s.keyword === norm || s.keyword === 'step');
|
|
77
|
+
}
|
|
78
|
+
/** Match full step text (no keyword prefix) against cached patterns. */
|
|
79
|
+
matchLine(stepText) {
|
|
80
|
+
for (const step of this.steps) {
|
|
81
|
+
const rx = patternToRegex(step.pattern);
|
|
82
|
+
const m = rx.exec(stepText);
|
|
83
|
+
if (m?.groups) {
|
|
84
|
+
return { step, params: { ...m.groups } };
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Return the step definition whose pattern matches *stepText* (no keyword prefix),
|
|
91
|
+
* or null if no pattern matches. Used by hover, definition, and linting.
|
|
92
|
+
*/
|
|
93
|
+
matchPattern(stepText) {
|
|
94
|
+
const trimmed = stepText.trim();
|
|
95
|
+
for (const step of this.getAll()) {
|
|
96
|
+
const rx = patternToRegex(step.pattern);
|
|
97
|
+
if (rx.test(trimmed)) {
|
|
98
|
+
return step;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Return the parameter the cursor (at *column*) sits inside on *lineText*,
|
|
105
|
+
* or null if the cursor is not inside a parameter value.
|
|
106
|
+
*
|
|
107
|
+
* Positions are computed by walking literal segment lengths so that a
|
|
108
|
+
* placeholder value that also appears in the literal prefix (e.g. "state"
|
|
109
|
+
* in "the state is {state:AustralianState}") resolves to the correct span.
|
|
110
|
+
*/
|
|
111
|
+
paramPositionAt(lineText, column) {
|
|
112
|
+
for (const step of this.steps) {
|
|
113
|
+
const rx = patternToRegex(step.pattern);
|
|
114
|
+
const m = rx.exec(lineText);
|
|
115
|
+
if (!m?.groups)
|
|
116
|
+
continue;
|
|
117
|
+
// Split pattern into alternating [literal, placeholder, literal, ...]
|
|
118
|
+
const segments = step.pattern.split(/(\{[^}]{1,200}\})/);
|
|
119
|
+
let pos = 0; // cursor into lineText as we consume each segment
|
|
120
|
+
let paramIdx = 0; // index into step.parameters
|
|
121
|
+
for (let i = 0; i < segments.length; i++) {
|
|
122
|
+
if (i % 2 === 0) {
|
|
123
|
+
// literal segment — advance pos by its length
|
|
124
|
+
pos += segments[i].length;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
// parameter placeholder — the captured value starts at pos
|
|
128
|
+
const name = segments[i].replace(/^\{(\w+)(?::[^}]{1,200})?\}$/, '$1');
|
|
129
|
+
const value = m.groups[name];
|
|
130
|
+
if (value !== undefined) {
|
|
131
|
+
const valueStart = pos;
|
|
132
|
+
const valueEnd = pos + value.length;
|
|
133
|
+
if (column >= valueStart && column <= valueEnd) {
|
|
134
|
+
const param = step.parameters[paramIdx];
|
|
135
|
+
if (param) {
|
|
136
|
+
return { parameter: param, valueStart, valueEnd };
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
pos = valueEnd;
|
|
140
|
+
}
|
|
141
|
+
paramIdx++;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
exports.StepCache = StepCache;
|
|
149
|
+
//# sourceMappingURL=stepCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepCache.js","sourceRoot":"","sources":["../../src/steps/stepCache.ts"],"names":[],"mappings":";;;AAqBA,wCAeC;AAvBD,sFAAsF;AACtF;;;;;;GAMG;AACH,SAAgB,cAAc,CAAC,OAAe;IAC1C,6DAA6D;IAC7D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACjD,MAAM,QAAQ,GAAG,KAAK;SACjB,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;QACb,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACd,mEAAmE;YACnE,MAAM,IAAI,GAAG,IAAI,CAAC,OA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AAC,CAAC,CAAM,kDAAkD;YACpE,IAAI,QAAQ,GAAG,CAAC,CAAC,CAAC,6BAA6B;YAE/C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACvC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;oBACd,8CAA8C;oBAC9C,GAAG,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;gBAC9B,CAAC;qBAAM,CAAC;oBACJ,2DAA2D;oBAC3D,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,8BAA8B,EAAE,IAAI,CAAC,CAAC;oBACvE,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;oBAC7B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;wBACtB,MAAM,UAAU,GAAG,GAAG,CAAC;wBACvB,MAAM,QAAQ,GAAG,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC;wBACpC,IAAI,MAAM,IAAI,UAAU,IAAI,MAAM,IAAI,QAAQ,EAAE,CAAC;4BAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;4BACxC,IAAI,KAAK,EAAE,CAAC;gCACR,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;4BACtD,CAAC;wBACL,CAAC;wBACD,GAAG,GAAG,QAAQ,CAAC;oBACnB,CAAC;oBACD,QAAQ,EAAE,CAAC;gBACf,CAAC;YACL,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AA1HD,8BA0HC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Convert a step pattern to a Python snake_case function name. */
|
|
2
|
+
export declare function patternToFunctionName(pattern: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* A Python step function stub for *stepText*.
|
|
5
|
+
*
|
|
6
|
+
* And/But map to `step`, since pytest-bdd has no decorator for them — they bind
|
|
7
|
+
* to whichever of given/when/then precedes them at runtime.
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildStepStub(stepText: string, keyword: string): string;
|
|
10
|
+
//# sourceMappingURL=stubs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stubs.d.ts","sourceRoot":"","sources":["../../src/steps/stubs.ts"],"names":[],"mappings":"AAaA,mEAAmE;AACnE,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAQ7D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAiBvE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2026 Nigel O'Keefe. All rights reserved.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
//
|
|
5
|
+
// Generates a pytest-bdd step function stub for an unimplemented step.
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.patternToFunctionName = patternToFunctionName;
|
|
8
|
+
exports.buildStepStub = buildStepStub;
|
|
9
|
+
const PARAM_RE = /\{(\w+)(?::[^}]{1,200})?\}/g;
|
|
10
|
+
const KEYWORD_TO_DECORATOR = {
|
|
11
|
+
given: 'given',
|
|
12
|
+
when: 'when',
|
|
13
|
+
then: 'then',
|
|
14
|
+
};
|
|
15
|
+
/** Convert a step pattern to a Python snake_case function name. */
|
|
16
|
+
function patternToFunctionName(pattern) {
|
|
17
|
+
return pattern
|
|
18
|
+
.replace(new RegExp(PARAM_RE.source, 'g'), '$1')
|
|
19
|
+
.replace(/[^\w\s]/g, ' ')
|
|
20
|
+
.trim()
|
|
21
|
+
.replace(/\s+/g, '_')
|
|
22
|
+
.replace(/_+/g, '_')
|
|
23
|
+
.toLowerCase();
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A Python step function stub for *stepText*.
|
|
27
|
+
*
|
|
28
|
+
* And/But map to `step`, since pytest-bdd has no decorator for them — they bind
|
|
29
|
+
* to whichever of given/when/then precedes them at runtime.
|
|
30
|
+
*/
|
|
31
|
+
function buildStepStub(stepText, keyword) {
|
|
32
|
+
const decorator = KEYWORD_TO_DECORATOR[keyword.toLowerCase()] ?? 'step';
|
|
33
|
+
const paramNames = [];
|
|
34
|
+
const re = new RegExp(PARAM_RE.source, 'g');
|
|
35
|
+
let m;
|
|
36
|
+
while ((m = re.exec(stepText)) !== null) {
|
|
37
|
+
paramNames.push(m[1]);
|
|
38
|
+
}
|
|
39
|
+
const fnArgs = paramNames.length > 0 ? `(${paramNames.join(', ')})` : '()';
|
|
40
|
+
return [
|
|
41
|
+
`@${decorator}("${stepText}")`,
|
|
42
|
+
`def ${patternToFunctionName(stepText)}${fnArgs}:`,
|
|
43
|
+
` raise NotImplementedError`,
|
|
44
|
+
].join('\n');
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=stubs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stubs.js","sourceRoot":"","sources":["../../src/steps/stubs.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,kCAAkC;AAClC,EAAE;AACF,uEAAuE;;AAWvE,sDAQC;AAQD,sCAiBC;AA1CD,MAAM,QAAQ,GAAG,6BAA6B,CAAC;AAE/C,MAAM,oBAAoB,GAA2B;IACjD,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;CACf,CAAC;AAEF,mEAAmE;AACnE,SAAgB,qBAAqB,CAAC,OAAe;IACjD,OAAO,OAAO;SACT,OAAO,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC;SAC/C,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC;SACxB,IAAI,EAAE;SACN,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,WAAW,EAAE,CAAC;AACvB,CAAC;AAED;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,QAAgB,EAAE,OAAe;IAC3D,MAAM,SAAS,GAAG,oBAAoB,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,IAAI,MAAM,CAAC;IAExE,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5C,IAAI,CAAyB,CAAC;IAC9B,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACtC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IAE3E,OAAO;QACH,IAAI,SAAS,KAAK,QAAQ,IAAI;QAC9B,OAAO,qBAAqB,CAAC,QAAQ,CAAC,GAAG,MAAM,GAAG;QAClD,+BAA+B;KAClC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StepCache } from './stepCache';
|
|
2
|
+
export type UnimplementedStep = {
|
|
3
|
+
/** 0-indexed line. */
|
|
4
|
+
lineIndex: number;
|
|
5
|
+
/** Step text with the Gherkin keyword stripped. */
|
|
6
|
+
stepText: string;
|
|
7
|
+
};
|
|
8
|
+
/** Steps in *lines* that no definition in *cache* matches. Comments are skipped. */
|
|
9
|
+
export declare function findUnimplementedSteps(lines: string[], cache: StepCache): UnimplementedStep[];
|
|
10
|
+
//# sourceMappingURL=unimplemented.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unimplemented.d.ts","sourceRoot":"","sources":["../../src/steps/unimplemented.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAK7C,MAAM,MAAM,iBAAiB,GAAG;IAC5B,sBAAsB;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,oFAAoF;AACpF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,SAAS,GAAG,iBAAiB,EAAE,CAY7F"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2026 Nigel O'Keefe. All rights reserved.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
//
|
|
5
|
+
// Finds steps in a feature file with no matching definition.
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.findUnimplementedSteps = findUnimplementedSteps;
|
|
8
|
+
const complete_1 = require("../completion/complete");
|
|
9
|
+
const COMMENT_RE = /^\s*#/;
|
|
10
|
+
/** Steps in *lines* that no definition in *cache* matches. Comments are skipped. */
|
|
11
|
+
function findUnimplementedSteps(lines, cache) {
|
|
12
|
+
const results = [];
|
|
13
|
+
for (let i = 0; i < lines.length; i++) {
|
|
14
|
+
const line = lines[i];
|
|
15
|
+
if (COMMENT_RE.test(line))
|
|
16
|
+
continue;
|
|
17
|
+
const parsed = (0, complete_1.extractStepText)(line);
|
|
18
|
+
if (!parsed)
|
|
19
|
+
continue;
|
|
20
|
+
if (!cache.matchPattern(parsed.text)) {
|
|
21
|
+
results.push({ lineIndex: i, stepText: parsed.text });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return results;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=unimplemented.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unimplemented.js","sourceRoot":"","sources":["../../src/steps/unimplemented.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,kCAAkC;AAClC,EAAE;AACF,6DAA6D;;AAe7D,wDAYC;AAxBD,qDAAyD;AAEzD,MAAM,UAAU,GAAG,OAAO,CAAC;AAS3B,oFAAoF;AACpF,SAAgB,sBAAsB,CAAC,KAAe,EAAE,KAAgB;IACpE,MAAM,OAAO,GAAwB,EAAE,CAAC;IACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;YAAE,SAAS;QACpC,MAAM,MAAM,GAAG,IAAA,0BAAe,EAAC,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,MAAM;YAAE,SAAS;QACtB,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YACnC,OAAO,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QAC1D,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { GherkinDocument } from '@cucumber/messages';
|
|
2
|
+
export type SymbolNodeKind = 'feature' | 'scenario';
|
|
3
|
+
export interface SymbolNode {
|
|
4
|
+
name: string;
|
|
5
|
+
/** Secondary text — tags, for scenarios. Empty when there is none. */
|
|
6
|
+
detail: string;
|
|
7
|
+
kind: SymbolNodeKind;
|
|
8
|
+
/** 0-indexed line the symbol starts on. */
|
|
9
|
+
line: number;
|
|
10
|
+
children: SymbolNode[];
|
|
11
|
+
}
|
|
12
|
+
export declare function buildSymbolTree(doc: GherkinDocument): SymbolNode[];
|
|
13
|
+
//# sourceMappingURL=outline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outline.d.ts","sourceRoot":"","sources":["../../src/symbols/outline.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,UAAU,CAAC;AAEpD,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,cAAc,CAAC;IACrB,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,UAAU,EAAE,CAAC;CAC1B;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,eAAe,GAAG,UAAU,EAAE,CA4BlE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2026 Nigel O'Keefe. All rights reserved.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
//
|
|
5
|
+
// Builds a document outline for a Gherkin file: the feature, with its scenarios
|
|
6
|
+
// and background beneath it.
|
|
7
|
+
//
|
|
8
|
+
// Returns plain nodes carrying a line number; hosts map `kind` onto their own
|
|
9
|
+
// symbol vocabulary and turn `line` into whatever range type they use.
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.buildSymbolTree = buildSymbolTree;
|
|
12
|
+
function buildSymbolTree(doc) {
|
|
13
|
+
if (!doc.feature)
|
|
14
|
+
return [];
|
|
15
|
+
const feature = doc.feature;
|
|
16
|
+
const featureNode = {
|
|
17
|
+
name: feature.name || '(unnamed feature)',
|
|
18
|
+
detail: '',
|
|
19
|
+
kind: 'feature',
|
|
20
|
+
line: (feature.location?.line ?? 1) - 1,
|
|
21
|
+
children: [],
|
|
22
|
+
};
|
|
23
|
+
for (const child of feature.children) {
|
|
24
|
+
const scenario = child.scenario ?? child.background;
|
|
25
|
+
if (!scenario)
|
|
26
|
+
continue;
|
|
27
|
+
const tags = ('tags' in scenario ? scenario.tags ?? [] : []).map((t) => t.name).join(' ');
|
|
28
|
+
featureNode.children.push({
|
|
29
|
+
name: scenario.name || (child.background ? '(background)' : '(unnamed scenario)'),
|
|
30
|
+
detail: tags,
|
|
31
|
+
kind: 'scenario',
|
|
32
|
+
line: (scenario.location?.line ?? 1) - 1,
|
|
33
|
+
children: [],
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return [featureNode];
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=outline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outline.js","sourceRoot":"","sources":["../../src/symbols/outline.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,kCAAkC;AAClC,EAAE;AACF,gFAAgF;AAChF,6BAA6B;AAC7B,EAAE;AACF,8EAA8E;AAC9E,uEAAuE;;AAgBvE,0CA4BC;AA5BD,SAAgB,eAAe,CAAC,GAAoB;IAChD,IAAI,CAAC,GAAG,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IAE5B,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;IAC5B,MAAM,WAAW,GAAe;QAC5B,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,mBAAmB;QACzC,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC;QACvC,QAAQ,EAAE,EAAE;KACf,CAAC;IAEF,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACnC,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,UAAU,CAAC;QACpD,IAAI,CAAC,QAAQ;YAAE,SAAS;QAExB,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE1F,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;YACtB,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,oBAAoB,CAAC;YACjF,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC;YACxC,QAAQ,EAAE,EAAE;SACf,CAAC,CAAC;IACP,CAAC;IAED,OAAO,CAAC,WAAW,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { GherkinDocument } from '@cucumber/messages';
|
|
2
|
+
export declare const TOKEN_TYPES: readonly ["gherkinDatatablePipe", "gherkinDatatableCell", "gherkinDatatableCellString", "gherkinExamplesPipe", "gherkinExamplesCell", "gherkinExamplesCellString", "gherkinExamplesHeaderCell"];
|
|
3
|
+
export type TokenType = (typeof TOKEN_TYPES)[number];
|
|
4
|
+
export interface TokenEntry {
|
|
5
|
+
line: number;
|
|
6
|
+
startChar: number;
|
|
7
|
+
length: number;
|
|
8
|
+
tokenType: TokenType;
|
|
9
|
+
}
|
|
10
|
+
export declare function buildTableTokens(doc: GherkinDocument, lines: string[]): TokenEntry[];
|
|
11
|
+
/** Position of each token type in the legend a host declares. */
|
|
12
|
+
export declare const TYPE_INDEX: Record<TokenType, number>;
|
|
13
|
+
//# sourceMappingURL=semanticTokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semanticTokens.d.ts","sourceRoot":"","sources":["../../src/tokens/semanticTokens.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAY,MAAM,oBAAoB,CAAC;AAEpE,eAAO,MAAM,WAAW,iMAQd,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,SAAS,CAAC;CACxB;AAwCD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,CA0BpF;AAED,iEAAiE;AACjE,eAAO,MAAM,UAAU,EAA4D,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) 2026 Nigel O'Keefe. All rights reserved.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
//
|
|
5
|
+
// Computes semantic token positions for Gherkin tables — pipes, cells, and
|
|
6
|
+
// quoted cells, distinguished between datatables and Examples tables.
|
|
7
|
+
//
|
|
8
|
+
// Returns plain positions. Encoding them into whatever the host's highlighter
|
|
9
|
+
// expects, and declaring the legend, is the host's job.
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.TYPE_INDEX = exports.TOKEN_TYPES = void 0;
|
|
12
|
+
exports.buildTableTokens = buildTableTokens;
|
|
13
|
+
exports.TOKEN_TYPES = [
|
|
14
|
+
'gherkinDatatablePipe',
|
|
15
|
+
'gherkinDatatableCell',
|
|
16
|
+
'gherkinDatatableCellString',
|
|
17
|
+
'gherkinExamplesPipe',
|
|
18
|
+
'gherkinExamplesCell',
|
|
19
|
+
'gherkinExamplesCellString',
|
|
20
|
+
'gherkinExamplesHeaderCell',
|
|
21
|
+
];
|
|
22
|
+
function isQuoted(value) {
|
|
23
|
+
const v = value.trim();
|
|
24
|
+
return (v.startsWith('"') && v.endsWith('"') && v.length >= 2) ||
|
|
25
|
+
(v.startsWith("'") && v.endsWith("'") && v.length >= 2);
|
|
26
|
+
}
|
|
27
|
+
function emitRow(row, lines, pipeType, cellType, cellStringType, out) {
|
|
28
|
+
const lineIndex = row.location.line - 1;
|
|
29
|
+
const lineText = lines[lineIndex] ?? '';
|
|
30
|
+
const pipePositions = [];
|
|
31
|
+
for (let i = 0; i < lineText.length; i++) {
|
|
32
|
+
if (lineText[i] === '|')
|
|
33
|
+
pipePositions.push(i);
|
|
34
|
+
}
|
|
35
|
+
for (const pos of pipePositions) {
|
|
36
|
+
out.push({ line: lineIndex, startChar: pos, length: 1, tokenType: pipeType });
|
|
37
|
+
}
|
|
38
|
+
row.cells.forEach((cell, i) => {
|
|
39
|
+
const start = pipePositions[i];
|
|
40
|
+
const end = pipePositions[i + 1];
|
|
41
|
+
if (start === undefined || end === undefined)
|
|
42
|
+
return;
|
|
43
|
+
out.push({
|
|
44
|
+
line: lineIndex,
|
|
45
|
+
startChar: start + 1,
|
|
46
|
+
length: end - start - 1,
|
|
47
|
+
tokenType: isQuoted(cell.value) ? cellStringType : cellType,
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function buildTableTokens(doc, lines) {
|
|
52
|
+
const tokens = [];
|
|
53
|
+
for (const child of doc.feature?.children ?? []) {
|
|
54
|
+
const scenario = child.scenario;
|
|
55
|
+
if (!scenario)
|
|
56
|
+
continue;
|
|
57
|
+
for (const step of scenario.steps) {
|
|
58
|
+
if (step.dataTable) {
|
|
59
|
+
for (const row of step.dataTable.rows) {
|
|
60
|
+
emitRow(row, lines, 'gherkinDatatablePipe', 'gherkinDatatableCell', 'gherkinDatatableCellString', tokens);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
for (const examples of scenario.examples) {
|
|
65
|
+
if (examples.tableHeader) {
|
|
66
|
+
emitRow(examples.tableHeader, lines, 'gherkinExamplesPipe', 'gherkinExamplesHeaderCell', 'gherkinExamplesHeaderCell', tokens);
|
|
67
|
+
}
|
|
68
|
+
for (const row of examples.tableBody) {
|
|
69
|
+
emitRow(row, lines, 'gherkinExamplesPipe', 'gherkinExamplesCell', 'gherkinExamplesCellString', tokens);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return tokens;
|
|
74
|
+
}
|
|
75
|
+
/** Position of each token type in the legend a host declares. */
|
|
76
|
+
exports.TYPE_INDEX = Object.fromEntries(exports.TOKEN_TYPES.map((t, i) => [t, i]));
|
|
77
|
+
//# sourceMappingURL=semanticTokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semanticTokens.js","sourceRoot":"","sources":["../../src/tokens/semanticTokens.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,kCAAkC;AAClC,EAAE;AACF,2EAA2E;AAC3E,sEAAsE;AACtE,EAAE;AACF,8EAA8E;AAC9E,wDAAwD;;;AA6DxD,4CA0BC;AAnFY,QAAA,WAAW,GAAG;IACvB,sBAAsB;IACtB,sBAAsB;IACtB,4BAA4B;IAC5B,qBAAqB;IACrB,qBAAqB;IACrB,2BAA2B;IAC3B,2BAA2B;CACrB,CAAC;AAUX,SAAS,QAAQ,CAAC,KAAa;IAC3B,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IACvB,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAA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AAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAA8B,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { DiscoveredTestNode } from '../protocol/types';
|
|
2
|
+
export interface TreeNodeRange {
|
|
3
|
+
start: {
|
|
4
|
+
line: number;
|
|
5
|
+
character: number;
|
|
6
|
+
};
|
|
7
|
+
end: {
|
|
8
|
+
line: number;
|
|
9
|
+
character: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface TreeNodeUri {
|
|
13
|
+
/** Resolved against the run's working directory unless `absolute` is set. */
|
|
14
|
+
path: string;
|
|
15
|
+
absolute?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface TreeNode {
|
|
18
|
+
id: string;
|
|
19
|
+
label: string;
|
|
20
|
+
uri: TreeNodeUri;
|
|
21
|
+
canResolveChildren: boolean;
|
|
22
|
+
tags: string[];
|
|
23
|
+
description?: string;
|
|
24
|
+
range?: TreeNodeRange;
|
|
25
|
+
children: TreeNode[];
|
|
26
|
+
}
|
|
27
|
+
export interface BuiltTree {
|
|
28
|
+
roots: TreeNode[];
|
|
29
|
+
/** Leaf node id → pytest runID. Hosts index their own items from this. */
|
|
30
|
+
idToRunId: Map<string, string>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Build the tree.
|
|
34
|
+
*
|
|
35
|
+
* BDD items — those carrying `feature_path` — are organised under a hierarchy
|
|
36
|
+
* mirroring the .feature file layout. Anything else falls back to a flat
|
|
37
|
+
* file-based hierarchy.
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildTestTree(rootNode: DiscoveredTestNode): BuiltTree;
|
|
40
|
+
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/tree/builder.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAsB,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEhF,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C;AAED,MAAM,WAAW,WAAW;IACxB,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,WAAW,CAAC;IACjB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,QAAQ,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,SAAS;IACtB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,0EAA0E;IAC1E,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AA2DD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,kBAAkB,GAAG,SAAS,CAmFrE"}
|