Closed richardszanyi-kasa closed 2 years ago
It appears that you’re mixing two versions and haven’t upgraded completely.
I just removed it, sorry. Same error.
Then you need to provide a reproducible example.
I've found the issue.
if stepDefinitions/e2e.ts
has any hook, it fails loading and the error message occurs.
However, if I delete every hook from that file, it can run correctly.
Afaik the stepDefinitions/e2e.ts
can be used for hooks that has to run before every scenario. The error message points to an error in the support/e2e.ts
however I suspect that some reading issue is happening here.
Edit1: Renaming the stepDefinitions/e2e.ts
to stepDefinitions/beforeAll.ts
seems to not solve the issue. Only removing the hooks resolve it.
Do you have any idea why is that, or how to workaround?
See my comment above.
I cannot reproduce it properly on a clean fw. It sometimes comes up, sometimes it does not. I'm not even sure what it is that its trying to resolve, and what is global registry, so I might find the issue here? Is that something to do with me rewriting JS to TS, and it parses the code badly, or some configuration option? I'm really not sure. I could find out that:
Before
or After
hook in the e2e.ts it invokes the defineBefore()
function from the dependency with undefined value. Before
and After
from the e2e.ts, it doesn't invoke those function.
I would assume there is something to do with the path resolve after all? :/ Also note, I'm starting an integration test with *.ts, and not a .feature test inside the fw. I'm pretty sure the dependency should not init on those.
My issue seems to be resolved by removing import 'cypress-waitfor'
with the cypress-waitfor
package.
nvm, still having the issue. It is really flaky. If anyone has any idea let me know.
Sorry for taking that long, I've found the issue and have a workaround for that, however:
https://github.com/richardszanyi-kasa/cypress-cucumber-preprocessor-bug-repro/
Here is the reproducible example.
(The issue was that the e2e.ts
which has a Before
and After
hook also stores a globally used variable object called Vars
. If any test uses this Vars
object, e2e.ts
will be loaded, and somehow the preprocessor cannot do anything with that, if you remove Vars
from e2e\e2e.ts
it works.)
Let me know your thoughts. Cheers, Richard
You can't run methods imported from @badeball/cypress-cucumber-preprocessor
in a non-feature test (google.ts), which is essentially what you're doing (although maybe not you intended to or even realized).
A better error message would suffice here then. That makes sense, thanks.
Hi,
I recently updated our framework to use cypress 10.x, and typescript. Also changed to the latest cypress-cucumber-preprocessor from you, and I thank you for that for updating this package. Yesterday it was working perfectly. Today I did an
npm update
and it broke all of it. I was wondering why, and it pointed me to this package, where the error message said that I should report this as a bug, so I am doing that rn. :)I cannot give you an example repo unfortunately due to capacity, however maybe you can point out what is its problem with my package json after
npm update
, or maybe there is a bug you can see from that either way.Thank you, you are awesome!
Dependencies we use:
Current behavior
After using npm update and updating my packages, this error message comes up after loading a test case.
Desired behavior
Works as expected
Versions
Checklist
cypress-cucumber-preprocessor@4.3.1
(package name has changed and it is no longer the most recent version, see #689).