forked from Klaveness-Digital/cypress-cucumber-preprocessor
-
-
Notifications
You must be signed in to change notification settings - Fork 149
/
index.ts
107 lines (88 loc) · 2.49 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import messages from "@cucumber/messages";
import DataTable from "./data_table";
import {
IHookBody,
IParameterTypeDefinition,
IStepDefinitionBody,
} from "./types";
import * as Methods from "./methods";
declare global {
interface Window {
testState: {
gherkinDocument: messages.GherkinDocument;
pickles: messages.Pickle[];
pickle: messages.Pickle;
pickleStep?: messages.PickleStep;
};
}
}
export { resolve as resolvePreprocessorConfiguration } from "./preprocessor-configuration";
export {
getStepDefinitionPatterns,
getStepDefinitionPaths,
} from "./step-definitions";
export {
default as addCucumberPreprocessorPlugin,
beforeRunHandler,
afterRunHandler,
beforeSpecHandler,
afterSpecHandler,
afterScreenshotHandler,
} from "./add-cucumber-preprocessor-plugin";
/**
* Everything below exist merely for the purpose of being nice with TypeScript. All of these methods
* are exclusively used in the browser and the browser field in package.json points to ./methods.ts.
*/
function createUnimplemented() {
return new Error("Cucumber methods aren't available in a node environment");
}
export { NOT_FEATURE_ERROR } from "./methods";
export function isFeature(): boolean {
throw createUnimplemented();
}
export function doesFeatureMatch(expression: string): boolean {
throw createUnimplemented();
}
export function defineStep<T extends unknown[]>(
description: string | RegExp,
implementation: IStepDefinitionBody<T>
) {
throw createUnimplemented();
}
export {
defineStep as Given,
defineStep as When,
defineStep as Then,
defineStep as And,
defineStep as But,
};
export function Step(
world: Mocha.Context,
text: string,
argument?: DataTable | string
) {
throw createUnimplemented();
}
export function defineParameterType<T>(options: IParameterTypeDefinition<T>) {
throw createUnimplemented();
}
export function attach(data: string | ArrayBuffer, mediaType?: string) {
throw createUnimplemented();
}
export function Before(options: { tags?: string }, fn: IHookBody): void;
export function Before(fn: IHookBody): void;
export function Before(
optionsOrFn: IHookBody | { tags?: string },
maybeFn?: IHookBody
) {
throw createUnimplemented();
}
export function After(options: { tags?: string }, fn: IHookBody): void;
export function After(fn: IHookBody): void;
export function After(
optionsOrFn: IHookBody | { tags?: string },
maybeFn?: IHookBody
) {
throw createUnimplemented();
}
export { default as DataTable } from "./data_table";