I was following a tutorial but the setup is really bad. Basically it uses typescript to convert .ts files to .js. So basically pollutes your whole source code with .js files around.
So as soon as you import your .ts file from source code, all dependencies are duplicated with a .js file.
Do you know how to do proper typescript cucumber tests?
A hacky solution: Copy all features and all files to another temp folder, run from there. I would expect cucumber to be a bit more mature than this, hence my question here?
Or change the configuration of cucumber to look in the build folder from ts.
Thank you
Why just using typescript won't work:
Code structure:
- tests
- a.feature
- stepDefinitions.ts
Now you will compile the typescript and have this structure:
- tests
- a.feature
- stepDefinitions.ts
- build
- tests
- stepDefinitions.js
- tests
Now you can see that stepDefinitions.js
has no idea where to find a.feature
. If you run cucumber on the build/test folder it won't find any step feature to run... because well, they are in the tests folder. So the hacky way to fix it is to copy over the features files resulting this structure:
- tests
- a.feature
- stepDefinitions.ts
- build
- tests
- a.feature
- stepDefinitions.js
- tests
Now it will work but is hacky, I don't like it.