-
Notifications
You must be signed in to change notification settings - Fork 41
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
ESM/TypeScript: Cant get new 1.0.x version to work with Jest/Puppeteer/TypeScript or ESM #869
Comments
👋🏼 This sounds like there's some compilation of the SDK going on. I'll have to look at your build system when I get a moment but my guess is it's transforming / falling over at the dynamic import. The example app runs fine, so its likely the build process causing issues. (FWIW, you'll need to use v1.x of the CLI with 2.0.1 of the Puppeteer SDK.) |
The "build process" as it may be is using Jest and TS ( Maybe i need to add something to TS so it understands these imports? https://github.com/percy/cli/blob/master/packages/logger/src/index.js#L1 |
@Robdel12 i circled back on this. Still cant find a solution. I cant see any way to use percy anymore with ES6 or TS after the new version. If you take a look at https://github.com/percy/example-percy-puppeteer it might run fine but if you updated it to ES6 I think what it would take to fix this is maybe not doing a dynamic import? Could you do it twice and import each file? i did try this in MY package.json but then it gives
Best branch so far is https://github.com/infor-design/enterprise-wc/tree/change-jest-to-esm steps above. Let me know if i should go through support or anything as we have to stay on the beta version and cant go to ES modules and we are paying monthly so not sure if that will ever stop working? BTW after some period of testing it out will get this and have to restart the command line (Mac)
Thanks |
@Robdel12 hi, any updates on this? |
@Robdel12 Here you go with an example repo for this case: Please check and might be you'll be able to tell what's wrong in the build process? |
@frixatrix yes we definitely have the same problem I was trying to see if i could make something like this work, but was unable. So floating the idea in case you can?
Im thinking it would be more compatible if the percy team avoided the import like this... Cant see any way to make this work anymore. |
@tmcconechy I found that if you change import in from
to
It may not fail the test... At least my example test passed after applying that.
And percy snapshot submission also sent out. |
Yeah i agree i think maybe thats the easiest solution - not do these imports this way. Especially since the consumer dont know how to figure it out. But there is a case with two imports here https://github.com/percy/cli/blob/master/packages/logger/package.json#L31-L34 im not sure about. So maybe you guys can just switch to normal imports? @Robdel12 ? |
Would be great if anyone will fix that and let us know instead of one dropdead reply month ago and we as paying users will be able to stop using version which is:
|
Agreed - did you try to "escalate" this with support? Thinking about it since no replies... |
👋🏼 Sorry! There's two of us to manage 16 SDKs and I also have to manage support in between that. We're currently working on reverting |
Thank you @Robdel12 ! @tmcconechy Funny that I sent to support another issue (not related to TS and newer percy libraries, my current builds on "@percy/cli": "^1.0.0-beta.55", "@percy/puppeteer": "^2.0.0" had started failing without any changes in codebase) but they answered that the issue I sent is linked to this one and I should wait for fix on this. |
👋🏼 This should be resolved with v1.1.2. I was able to confirm it's fixed for the reproduction that @frixatrix provided For @tmcconechy -- I was able to confirm the project builds and doesn't have resolve errors from |
@Robdel12 Thank You! If I'm reading the fix correctly i should'nt have to use ES modules right? Or is it still ES modules? First attempt im getting this:
|
@Robdel12 I prepared another example repo with tests which are failing if there is This repo setup is kind of I have on my projects and I don't get how can I run bunch of existing Percy tests again. And that's weird but in my project tests with percy does not fail - they just never finishes despite any timeouts for jest/jest-puppeter (might be similar to https://github.com/gliff-ai/manage/issues/334 ) UPD: Was able to reproduce forever hanging tests with |
After further attempts im still stuck on the problem above. I can run "experimental VM" but when i do this i just get segmentation faults. It appears the fix you made @Robdel12 would remove ES modules so i dont get 100% why maybe there is some part left in and additional fix is needed? I would suggest in a tool like this we go for ES Modules when its not blocked in Jest https://jestjs.io/blog/2022/04/25/jest-28#ecmascript-modules and not "experimental" in node js. |
@tmcconechy there's even request about it supporting ESM: percy/percy-puppeteer#426 |
It's no longer experimental in Node (hasn't been since 2 years ago with Node 14). We're likely going to undo the dynamic import since Jest is so far behind (it looks close to abandonware with just one maintainer really doing all the work). |
@frixatrix Just confirmed backing |
@Robdel12 Thank you! Just've confirmed that Tomorrow will check if that also fixes hanging in https://github.com/frixatrix/example-percy-jest-puppeteer . UPD on ^: Updated repo. |
Puppeteer v2.0.2 was released and should remove the need to have the |
Thanks so much @Robdel12 - can confirm this solves it for me. Feel free to close (whatever your process is for that) |
Awesome! Super happy to hear 😃 I'll close this up now -- if anything creeps up feel free to comment again 💯 |
The problem
Not sure if this is a bug or support issue if it is is just let me know and i'll redirect my question to discussions or support.
The problem is i cant get your new 1.0.5 (any 1.0.0) version to work anymore in any configuration using jest/puppetteer.
Seems like all the tooling is not in place on those ends so not sure what to do.
Environment
@percy/cli
version: 1.0.5Details
Given below details i cant seem to find a way to use the new version. So sort of at a road block and need to revert to
1.0.0-beta.76
which may not be sustainable if you change things. Also wondering if this should be a major version as it requires major project changes in order to use itComment on Versioning
Also (this took me a while to figure out...)
Reverting to "@percy/cli": "^1.0.0-beta.76" "@percy/puppeteer": "^2.0.0" works.
So given that shouldn't these be major versions with breaking changes and more details and examples? Cant seem to find an example of using puppetteer in TS or ESM with jest and percy.
Debug logs
Code to reproduce issue
Without ESM Conversion
npm i
npx jest -- accordion-percy
JEST_PUPPETEER_CONFIG=jest-puppeteer.config.cjs node --experimental-vm-modules node_modules/jest/bin/jest.js -- accordion-percy
With ESM Conversion
npm i
JEST_PUPPETEER_CONFIG=jest-puppeteer.config.cjs node --experimental-vm-modules node_modules/jest/bin/jest.js -- accordion-percy
See the error
Cannot find module '#logger' from 'node_modules/@percy/logger/dist/index.js'
The text was updated successfully, but these errors were encountered: