├── cucumber-tsflow ├── README.md ├── .npmignore ├── src │ ├── logger.ts │ ├── index.ts │ ├── tag-normalization.ts │ ├── scenario-context.ts │ ├── provided-context.ts │ ├── types.ts │ ├── step-binding-flags.ts │ ├── step-binding.ts │ ├── our-callsite.ts │ ├── managed-scenario-context.ts │ ├── scenario-info.ts │ ├── hook-decorators.ts │ ├── step-definition-decorators.ts │ ├── binding-registry.ts │ └── binding-decorator.ts ├── tsconfig.json └── package.json ├── lerna.json ├── .gitignore ├── .vscode ├── settings.json └── launch.json ├── .npm-upgrade.json ├── version.json ├── tsconfig.json ├── tslint.json ├── cucumber-tsflow-specs ├── package.json ├── tsconfig.json ├── src │ ├── step_definitions │ │ ├── file_steps.ts │ │ ├── cucumber_steps.ts │ │ ├── prepare.ts │ │ └── scenario_steps.ts │ └── support │ │ ├── testDir.ts │ │ ├── formatter_output_helpers.ts │ │ ├── runner.ts │ │ └── helpers.ts └── features │ ├── basic-test.feature │ ├── cucumber-context-objects.feature │ ├── global-hooks.feature │ ├── external-context-extraction.feature │ ├── tag-parameters.feature │ ├── custom-context-objects.feature │ └── hooks.feature ├── .build └── setPackageVersion.js ├── cucumber.js ├── .run ├── Template Cucumber.js.run.xml └── All Tests.run.xml ├── .github └── workflows │ ├── ci.yml │ ├── stale.yml │ └── release.yml ├── CONTRIBUTE.md ├── LICENSE ├── package.json └── README.md /cucumber-tsflow/README.md: -------------------------------------------------------------------------------- 1 | ../README.md -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": ["*"], 3 | "version": "3.4.1" 4 | } 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | tmp/ 4 | .idea/ 5 | tsconfig.tsbuildinfo 6 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules\\typescript\\lib" 3 | } 4 | -------------------------------------------------------------------------------- /cucumber-tsflow/.npmignore: -------------------------------------------------------------------------------- 1 | *.ts 2 | tsconfig.json 3 | typings.json 4 | typings 5 | .npmignore 6 | *.tsbuildinfo 7 | !dist/**/*.d.ts 8 | -------------------------------------------------------------------------------- /cucumber-tsflow/src/logger.ts: -------------------------------------------------------------------------------- 1 | import * as log4js from "log4js"; 2 | 3 | const logger = log4js.getLogger("cucumber-js.tsflow"); 4 | 5 | export default logger; 6 | -------------------------------------------------------------------------------- /.npm-upgrade.json: -------------------------------------------------------------------------------- 1 | { 2 | "ignore": { 3 | "@cucumber/cucumber": { 4 | "versions": "^8", 5 | "reason": "Mantain compatibility with cucumber 7 and 8" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /version.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", 3 | "version": "4.6", 4 | "publicReleaseRefSpec": ["^refs/heads/master$", "^refs/heads/release/"] 5 | } 6 | -------------------------------------------------------------------------------- /cucumber-tsflow/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./binding-decorator"; 2 | export * from "./hook-decorators"; 3 | export * from "./step-definition-decorators"; 4 | export { ScenarioContext, ScenarioInfo } from "./scenario-context"; 5 | export * from "./provided-context"; 6 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "experimentalDecorators": true, 4 | "esModuleInterop": true 5 | }, 6 | "files": [], 7 | "include": [], 8 | "references": [ 9 | { 10 | "path": "./cucumber-tsflow" 11 | }, 12 | { 13 | "path": "./cucumber-tsflow-specs" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /cucumber-tsflow/src/tag-normalization.ts: -------------------------------------------------------------------------------- 1 | export function normalizeTag(tag?: string): string | undefined { 2 | // Tag is not provided or already includes a @ 3 | if (tag === undefined || tag.includes("@")) { 4 | return tag; 5 | } 6 | 7 | // If a tag doesn't include any @, for compatibility, prefix it with a @ 8 | return `@${tag}`; 9 | } 10 | -------------------------------------------------------------------------------- /cucumber-tsflow/src/scenario-context.ts: -------------------------------------------------------------------------------- 1 | import { ScenarioInfo } from "./scenario-info"; 2 | 3 | /** 4 | * Provides context for the currently running Cucumber scenario. 5 | */ 6 | export interface ScenarioContext { 7 | /** 8 | * Gets information about the scenario. 9 | * 10 | */ 11 | scenarioInfo: ScenarioInfo; 12 | 13 | /** 14 | * Gets or sets an arbitary object within the running scenario. 15 | */ 16 | [key: string]: any; 17 | } 18 | 19 | export * from "./scenario-info"; 20 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": ["tslint:recommended", "tslint-config-prettier"], 4 | "jsRules": {}, 5 | "rules": { 6 | "variable-name": [ 7 | true, 8 | "allow-leading-underscore", 9 | "allow-trailing-underscore", 10 | "allow-pascal-case" 11 | ], 12 | "interface-name": [false], 13 | "object-literal-sort-keys": false, 14 | "member-ordering": [false], 15 | "object-literal-shorthand": false, 16 | "trailing-comma": ["multiline"] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /cucumber-tsflow/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "module": "umd", 5 | "moduleResolution": "node", 6 | "target": "es2018", 7 | "declaration": true, 8 | "declarationMap": true, 9 | "sourceMap": true, 10 | "strict": true, 11 | "skipLibCheck": true, 12 | "noUnusedLocals": true, 13 | "noUnusedParameters": true, 14 | "removeComments": false, 15 | "experimentalDecorators": true, 16 | "outDir": "./dist", 17 | "rootDir": "./src" 18 | }, 19 | "include": ["./src/**/*.ts"] 20 | } 21 | -------------------------------------------------------------------------------- /cucumber-tsflow-specs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cucumber-tsflow-specs", 3 | "version": "3.4.1", 4 | "private": true, 5 | "description": "Specification for 'cucumber-tsflow'.", 6 | "license": "MIT", 7 | "author": "Tim Roberts ", 8 | "main": "./index.js", 9 | "typings": "./dist/index.d.ts", 10 | "dependencies": { 11 | "@cucumber/query": "^13.2.0", 12 | "cucumber-tsflow": "^4", 13 | "expect": "^29.7.0", 14 | "fs-extra": "^11.1.0", 15 | "verror": "^1.10.1" 16 | }, 17 | "devDependencies": { 18 | "@types/fs-extra": "^11.0.1", 19 | "@types/verror": "^1.10.6" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /.build/setPackageVersion.js: -------------------------------------------------------------------------------- 1 | const nbgv = require("nerdbank-gitversioning"); 2 | 3 | const setPackageVersionAndBuildNumber = (versionInfo) => { 4 | // Set a build output value representing the NPM package version 5 | console.log( 6 | "::set-output name=package_version::" + versionInfo.npmPackageVersion, 7 | ); 8 | 9 | nbgv.setPackageVersion("cucumber-tsflow"); 10 | nbgv.setPackageVersion("cucumber-tsflow-specs"); 11 | }; 12 | 13 | const handleError = (err) => 14 | console.error( 15 | "Failed to update the package version number. nerdbank-gitversion failed: " + 16 | err, 17 | ); 18 | 19 | nbgv.getVersion().then(setPackageVersionAndBuildNumber).catch(handleError); 20 | -------------------------------------------------------------------------------- /cucumber.js: -------------------------------------------------------------------------------- 1 | const cucumberPkg = require("@cucumber/cucumber/package.json"); 2 | 3 | module.exports = cucumberPkg.version.startsWith("7.") 4 | ? { 5 | default: [ 6 | "--publish-quiet", 7 | "--require-module ts-node/register", 8 | "--require cucumber-tsflow-specs/src/**/*.ts", 9 | "--tags 'not @newApis'", 10 | '--world-parameters \'{"foo":"bar"}\'', 11 | ].join(" "), 12 | } 13 | : { 14 | default: { 15 | requireModule: ["ts-node/register"], 16 | require: ["cucumber-tsflow-specs/src/**/*.ts"], 17 | tags: "not @oldApis", 18 | worldParameters: { 19 | foo: "bar", 20 | }, 21 | }, 22 | }; 23 | -------------------------------------------------------------------------------- /cucumber-tsflow-specs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "moduleResolution": "node", 5 | "module": "umd", 6 | "target": "es2018", 7 | "declaration": true, 8 | "declarationMap": true, 9 | "sourceMap": true, 10 | "strict": true, 11 | "skipLibCheck": true, 12 | "noUnusedLocals": true, 13 | "noUnusedParameters": true, 14 | "removeComments": false, 15 | "esModuleInterop": true, 16 | "noEmit": true, 17 | "experimentalDecorators": true, 18 | "outDir": "./dist", 19 | "rootDir": "./src" 20 | }, 21 | "include": ["./src/**/*.ts"], 22 | "references": [ 23 | { 24 | "path": "../cucumber-tsflow" 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /cucumber-tsflow-specs/src/step_definitions/file_steps.ts: -------------------------------------------------------------------------------- 1 | import { binding, given } from "cucumber-tsflow"; 2 | import { TestRunner } from "../support/runner"; 3 | 4 | @binding([TestRunner]) 5 | class FileSteps { 6 | public constructor(private readonly runner: TestRunner) {} 7 | 8 | @given("a file named {string} with:") 9 | public newFile(filePath: string, fileContent: string) { 10 | this.runner.dir.writeFile(filePath, fileContent); 11 | } 12 | 13 | @given("an empty file named {string}") 14 | public newEmptyFile(filePath: string) { 15 | return this.newFile(filePath, ""); 16 | } 17 | 18 | @given("a directory named {string}") 19 | public async newDir(filePath: string) { 20 | this.runner.dir.mkdir(filePath); 21 | } 22 | } 23 | 24 | export = FileSteps; 25 | -------------------------------------------------------------------------------- /.run/Template Cucumber.js.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |