@swedevtools/livedoc-vitest 0.2.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.
@@ -0,0 +1,104 @@
1
+ import { F as FeatureContext, S as ScenarioContext, a as StepContext, B as BackgroundContext, b as SpecificationContext, R as RuleContext } from './RuleContext-BZhuy-zS.js';
2
+ import '@swedevtools/livedoc-schema';
3
+
4
+ /**
5
+ * The context object passed to all LiveDoc test functions.
6
+ * Provides access to feature, scenario, step, example, and background contexts.
7
+ */
8
+ interface LiveDocTestContext {
9
+ /** Framework metadata about the current feature */
10
+ feature?: FeatureContext;
11
+ /** Framework metadata about the current scenario */
12
+ scenario?: ScenarioContext;
13
+ /** Framework metadata about the current step */
14
+ step?: StepContext;
15
+ /** Framework metadata about the current scenario outline example */
16
+ example?: ScenarioContext;
17
+ /** Framework metadata about the background */
18
+ background?: BackgroundContext;
19
+ }
20
+
21
+ /**
22
+ * The context object passed to Specification pattern test functions.
23
+ */
24
+ interface SpecificationTestContext {
25
+ /** Framework metadata about the current specification */
26
+ specification?: SpecificationContext;
27
+ /** Framework metadata about the current rule */
28
+ rule?: RuleContext;
29
+ /** Example data for rule outlines */
30
+ example?: Record<string, any>;
31
+ }
32
+
33
+ declare global {
34
+ /**
35
+ * Define a Gherkin feature
36
+ */
37
+ function feature(title: string, fn: (ctx: LiveDocTestContext) => void): void;
38
+
39
+ /**
40
+ * Define a scenario within a feature
41
+ */
42
+ function scenario(title: string, fn: (ctx: LiveDocTestContext) => void | Promise<void>): void;
43
+
44
+ /**
45
+ * Define a scenario outline (data-driven test)
46
+ * Examples are extracted from the title string by the parser
47
+ */
48
+ function scenarioOutline(title: string, fn: (ctx: LiveDocTestContext) => void): void;
49
+
50
+ /**
51
+ * Define background steps that run before each scenario
52
+ */
53
+ function background(title: string, fn: (ctx: LiveDocTestContext & {
54
+ afterBackground: (fn: () => void | Promise<void>) => void;
55
+ }) => void): void;
56
+
57
+ /**
58
+ * Define a given step (precondition)
59
+ */
60
+ function given(title: string, fn?: (ctx: LiveDocTestContext) => void | Promise<void>, passedParam?: object | Function): void;
61
+
62
+ /**
63
+ * Define a when step (action)
64
+ */
65
+ function when(title: string, fn?: (ctx: LiveDocTestContext) => void | Promise<void>, passedParam?: object | Function): void;
66
+
67
+ /**
68
+ * Define a then step (assertion)
69
+ * Available as lowercase global when using globals mode.
70
+ */
71
+ function then(title: string, fn?: (ctx: LiveDocTestContext) => void | Promise<void>, passedParam?: object | Function): void;
72
+
73
+ /**
74
+ * Define an and step (continuation)
75
+ */
76
+ function and(title: string, fn?: (ctx: LiveDocTestContext) => void | Promise<void>, passedParam?: object | Function): void;
77
+
78
+ /**
79
+ * Define a but step (continuation with contrast)
80
+ */
81
+ function but(title: string, fn?: (ctx: LiveDocTestContext) => void | Promise<void>, passedParam?: object | Function): void;
82
+
83
+ // ============================================
84
+ // Specification Pattern Globals
85
+ // ============================================
86
+
87
+ /**
88
+ * Define a specification (container for rules)
89
+ */
90
+ function specification(title: string, fn: (ctx: SpecificationTestContext) => void): void;
91
+
92
+ /**
93
+ * Define a rule within a specification
94
+ */
95
+ function rule(title: string, fn: (ctx: SpecificationTestContext) => void | Promise<void>): void;
96
+
97
+ /**
98
+ * Define a rule outline (data-driven rules)
99
+ * Examples are extracted from the title string by the parser
100
+ */
101
+ function ruleOutline(title: string, fn: (ctx: SpecificationTestContext) => void | Promise<void>): void;
102
+ }
103
+
104
+ export type { LiveDocTestContext, SpecificationTestContext };
@@ -0,0 +1 @@
1
+