hdorgeval / cucumber6-ts-starter Goto Github PK
View Code? Open in Web Editor NEWStarter project to write and debug cucumber-js features in TypeScript language
Starter project to write and debug cucumber-js features in TypeScript language
Hello,
Can you add a custom world constructor to this project? I have a class that extends World but all of the class properties are undefined when I try to access them in a step.
When the execution of npm run cucumber
fails, the report is not generated.
The issue is that, at least when running zsh on macOS, if you add additional source directories to the project, the wildcards in the cucumber-js command line are expanded, leading the cucumber interpreter to believe that the additional source files are actually feature files.
For example, as a part of transitioning to my own project, I added an additional directory under domains, and added .ts files into that directory:
domains/simple-maths
domains/simple-maths/simple-maths-calculator.ts
domains/chinsay
domains/chinsay/workspace.ts
Although npm run build reported no errors, running npm test reported errors like:
tardis (cjn) ~/src/Chinsay/cucumber-ts-starter ± ./node_modules/.bin/cucumber-js features/**/*.feature --logLevel=verbose --require build/**/*.js --require step-definitions/**/*.ts --require hooks/**/*.ts --require-module ts-node/register --format-options '{"snippetInterface": "async-await"}' --format json:reports/cucumber-report.json --format summary
Error: (1:1): expected: #EOF, #Language, #TagLine, #FeatureLine, #Comment, #Empty, got '"use strict";'
at /Users/cjn/src/Chinsay/cucumber-ts-starter/node_modules/cucumber/src/cli/helpers.js:63:13
at Array.forEach (<anonymous>)
at /Users/cjn/src/Chinsay/cucumber-ts-starter/node_modules/cucumber/src/cli/helpers.js:51:10
at Generator.next (<anonymous>)
at Generator.tryCatcher (/Users/cjn/src/Chinsay/cucumber-ts-starter/node_modules/bluebird/js/release/util.js:16:23)
at PromiseSpawn._promiseFulfilled (/Users/cjn/src/Chinsay/cucumber-ts-starter/node_modules/bluebird/js/release/generators.js:97:49)
at /Users/cjn/src/Chinsay/cucumber-ts-starter/node_modules/bluebird/js/release/generators.js:201:15
at getTestCases (/Users/cjn/src/Chinsay/cucumber-ts-starter/node_modules/cucumber/lib/cli/helpers.js:96:18)
at /Users/cjn/src/Chinsay/cucumber-ts-starter/node_modules/cucumber/src/cli/helpers.js:30:13
at Generator.next (<anonymous>)
at Generator.tryCatcher (/Users/cjn/src/Chinsay/cucumber-ts-starter/node_modules/bluebird/js/release/util.js:16:23)
at PromiseSpawn._promiseFulfilled (/Users/cjn/src/Chinsay/cucumber-ts-starter/node_modules/bluebird/js/release/generators.js:97:49)
at Promise._settlePromise (/Users/cjn/src/Chinsay/cucumber-ts-starter/node_modules/bluebird/js/release/promise.js:574:26)
at Promise._settlePromise0 (/Users/cjn/src/Chinsay/cucumber-ts-starter/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/Users/cjn/src/Chinsay/cucumber-ts-starter/node_modules/bluebird/js/release/promise.js:693:18)
at Async._drainQueue (/Users/cjn/src/Chinsay/cucumber-ts-starter/node_modules/bluebird/js/release/async.js:133:16)
[1] 94694 exit 1 ./node_modules/.bin/cucumber-js features/**/*.feature --logLevel=verbose
The fix is straightforward: add quotes around the paths, so that cucumber itself performs the wildcard expansion, i.e. in package.json, replace
"cucumber": "./node_modules/.bin/cucumber-js features/**/*.feature --logLevel=error --require step-definitions/**/*.ts --require hooks/**/*.ts --require-module ts-node/register --format-options '{\"snippetInterface\": \"async-await\"}' --format json:reports/cucumber-report.json --format summary",
with:
"cucumber": "./node_modules/.bin/cucumber-js features/**/*.feature --logLevel=error --require 'step-definitions/**/*.ts' --require 'hooks/**/*.ts' --require-module ts-node/register --format-options '{\"snippetInterface\": \"async-await\"}' --format json:reports/cucumber-report.json --format summary",
Pull request coming.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.