diff --git a/types/cypress-cucumber-preprocessor/cypress-cucumber-preprocessor-tests.ts b/types/cypress-cucumber-preprocessor/cypress-cucumber-preprocessor-tests.ts new file mode 100644 index 0000000000..0f681383fb --- /dev/null +++ b/types/cypress-cucumber-preprocessor/cypress-cucumber-preprocessor-tests.ts @@ -0,0 +1,4 @@ +import { Then, Given } from 'cypress-cucumber-preprocessor/steps'; + +Then(`I see {string} in the title`, (title: string) => {}); // $ExpectType void +Given('I open Google page', () => {}); // $ExpectType void diff --git a/types/cypress-cucumber-preprocessor/index.d.ts b/types/cypress-cucumber-preprocessor/index.d.ts new file mode 100644 index 0000000000..8cca776626 --- /dev/null +++ b/types/cypress-cucumber-preprocessor/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for cypress-cucumber-preprocessor 1.12 +// Project: https://github.com/TheBrainFamily/cypress-cucumber-preprocessor +// Definitions by: Alec Brunelle +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export default function preprocessor(options?: any): (file: any) => Promise; + +/** + * @returns NodeJS.ReadableStream + */ +export function transform(file: any): any; diff --git a/types/cypress-cucumber-preprocessor/steps/index.d.ts b/types/cypress-cucumber-preprocessor/steps/index.d.ts new file mode 100644 index 0000000000..d075af5847 --- /dev/null +++ b/types/cypress-cucumber-preprocessor/steps/index.d.ts @@ -0,0 +1,14 @@ +export function given(expression: RegExp | string, implementation: (...args: any[]) => void): void; +export function when(expression: RegExp | string, implementation: (...args: any[]) => void): void; +export function then(expression: RegExp | string, implementation: (...args: any[]) => void): void; +export function and(expression: RegExp | string, implementation: (...args: any[]) => void): void; +export function but(expression: RegExp | string, implementation: (...args: any[]) => void): void; +export function defineStep(expression: RegExp | string, implementation: (...args: any[]) => void): void; +export function defineParameterType(): void; + +// Aliased versions of the above funcs. +export function Given(expression: RegExp | string, implementation: (...args: any[]) => void): void; +export function When(expression: RegExp | string, implementation: (...args: any[]) => void): void; +export function Then(expression: RegExp | string, implementation: (...args: any[]) => void): void; +export function And(expression: RegExp | string, implementation: (...args: any[]) => void): void; +export function But(expression: RegExp | string, implementation: (...args: any[]) => void): void; diff --git a/types/cypress-cucumber-preprocessor/tsconfig.json b/types/cypress-cucumber-preprocessor/tsconfig.json new file mode 100644 index 0000000000..05bf3cbbad --- /dev/null +++ b/types/cypress-cucumber-preprocessor/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "target": "es6" + }, + "files": [ + "index.d.ts", + "steps/index.d.ts", + "cypress-cucumber-preprocessor-tests.ts" + ] +} diff --git a/types/cypress-cucumber-preprocessor/tslint.json b/types/cypress-cucumber-preprocessor/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/cypress-cucumber-preprocessor/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }