Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript with-out-of-the-box -> "undefined is not a function" #426

Closed
hiaux0 opened this issue Aug 4, 2020 · 6 comments
Closed

Typescript with-out-of-the-box -> "undefined is not a function" #426

hiaux0 opened this issue Aug 4, 2020 · 6 comments

Comments

@hiaux0
Copy link

hiaux0 commented Aug 4, 2020

Current behavior

Based on https:/TheBrainFamily/cypress-cucumber-preprocessor#with-out-of-the-box-support
and the official example repo, when I run the test-script

image

Oops...we found an error preparing this test file:
cypress/support/index.js
The error was:
TypeError: undefined is not a function

Desired behavior

No error

Test code to reproduce

https:/hiaux0/cypress-cucumber-example
One commit which adds out-of-the-box webpack preprocessing

Versions

  • Cypress version: v4.12.0
  • Preprocessor version: v2.5.4
  • Node version: v12.18.0
@lgandecki
Copy link
Collaborator

Thanks for the report @hiaux0 , sorry for the troubles. @bauglir would you be able to do some debugging? Do we need tsconfig or something?

@bauglir
Copy link
Contributor

bauglir commented Aug 5, 2020

Sorry for the slow response, apparently GitHub has stopped sending me notifications by e-mail again...

I don't think a tsconfig.json is strictly necessary, although any project actually using TypeScript should probably have one. The tests run fine without one for me, perhaps for IDE support it might be necessary, I'm not 100% sure.

The issue here is that this functionality isn't in a release yet, so depending on a released version (i.e. ^2.5.0) won't work. If I change the example repository to use the master branch the error doesn't occur. This error is actually caused by not having the most recent version of the @cypress/browserify-preprocessor being depended on by all packages.

I'm also not sure if the explicit dependency on @cypress/browserify-preprocessor is necessary. If I remove it in the example everything still works for me as well.

@pauljosephatay
Copy link

hi guys, seems to be a destructuring error in @cypress/browserify-preprocessor

const hasTsifyTransform = transform.some(([name]) => name.includes('tsify'))

cypress-cucumber-preprocessor wrapped the browserify options' transform with a function entry [Function: tranform, [{...}], [{...}]]

@bauglir
Copy link
Contributor

bauglir commented Aug 24, 2020

That issue is addressed in cypress-io/cypress-browserify-preprocessor#57 @pauljosephatay. The main problem here, as I mentioned in #426 (comment), is that the latest release of this package does not depend on at least v3.0.1 of @cypress/browserify-preprocessor. When depending on master of cypress-cucumber-preprocessor everything works as expected.

@lgandecki can you tag a new version so this issue can be closed?

lgandecki added a commit that referenced this issue Aug 24, 2020
There was an issue with a patch release, so this manual-releases.md
change is to release a new patch version.

Reference: #426
@lgandecki
Copy link
Collaborator

Sorry, something didn't click in the automatic release version and somehow I didn't understand your previous comment that basically stated that all we need is a release.
Fixed now!

@bauglir
Copy link
Contributor

bauglir commented Aug 25, 2020

No worries! I could probably have been a bit more to the point 😄

Thanks for the release 🎉 . I just updated my project to it and everything keeps working like a charm, so it should be all good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants