Code Monkey home page Code Monkey logo

Comments (19)

github-actions avatar github-actions commented on June 13, 2024 2

This issue is stale because it has been open for more than 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.

from percy-cypress.

stbth01 avatar stbth01 commented on June 13, 2024 1

was a resolution to this? I'm getting this sporadically in my build environment it will be 1 out of 300 test maybe but enough to be annoying.

We are on Cypress 9.6.1 and just using cypress default prepossessing with webpack.

from percy-cypress.

you1anna avatar you1anna commented on June 13, 2024 1

Any updates on this, I get a similar error on Cypress v9.7.0 with the latest Percy installed

npx percy exec -- cypress run --spec cypress/integration/RandR/Visual/*

     TypeError: Cannot read properties of undefined (reading 'write')
      at Function../node_modules/@percy/sdk-utils/dist/logger.js.logger.log (https://site1.dev/__cypress/tests?p=cypress/integration/RandR/Visual/pdf.spec.js:37669:53)
      at Object.info (https://site1.dev/__cypress/tests?p=cypress/integration/RandR/Visual/pdf.spec.js:37615:29)
      at Object.isPercyEnabled (https://site1.dev/__cypress/tests?p=cypress/integration/RandR/Visual/pdf.spec.js:37815:11)
      at async Context.eval (https://site1.dev/__cypress/tests?p=cypress/integration/RandR/Visual/pdf.spec.js:37450:10)

Any ideas?

from percy-cypress.

Robdel12 avatar Robdel12 commented on June 13, 2024

Hey @ayaanqui! This sounds like it's a compile issue -- are you doing anything in your cypress setup that changes how code is bundled? It looks like logger is being bundled in Cypress and process.stdout is polyfilled to be undefined.

from percy-cypress.

ayaanqui avatar ayaanqui commented on June 13, 2024

@Robdel12 here's what my cypress.json looks like:

{
  "baseUrl": "http://localhost:3000/stockcenter",
  "video": false,
  "defaultCommandTimeout": 10000,
  "chromeWebSecurity": false
}

from percy-cypress.

Robdel12 avatar Robdel12 commented on June 13, 2024

The pre-processor wouldn't be configured in the cypress.json -- looks like it's done in the plugins file: https://docs.cypress.io/api/plugins/preprocessors-api#Examples

Given this isn't an issue on the out-of-box setup (percy/example-percy-cypress@3f44d16), there's something different about your test suite causing this. A reproduction repo would be helpful

from percy-cypress.

alexbjorlig avatar alexbjorlig commented on June 13, 2024

We are also facing this issue πŸ˜… What should we look for in the plugins file?

from percy-cypress.

Robdel12 avatar Robdel12 commented on June 13, 2024

I'm not sure -- what is different in your plugins file? The issue is deff related to the bundle and how Percy's SDK is being polyfilled incorrectly. Something is not picking the correct bundle we're providing (we provide both a browser and node library).

A reproduction project would probably be most helpful since I can't replicate on a fresh cypress project. 🀨

from percy-cypress.

ayaanqui avatar ayaanqui commented on June 13, 2024

@Robdel12 Apologies for the late response, but I did make a repo that reproduces the issue github.com/ayaanqui/percy-snapshot-demo. Let me know if the project works for you. make sure to run yarn install then yarn start and finally yarn cypress:run which should fail the tests as shown in this issue. The test file should be in cypress/integration/test.ts.

from percy-cypress.

alexbjorlig avatar alexbjorlig commented on June 13, 2024

Can we somehow escalate this issue - is happening more and more. Will try to update cypress to version9 today to see if that improves anything

from percy-cypress.

ayaanqui avatar ayaanqui commented on June 13, 2024

@alexbjorlig Yes, I have noticed on other repos as well this is definitely an issue. github.com/ayaanqui/percy-snapshot-demo does replicate the issue as described here. Do let me know if you manage to find a solution.

from percy-cypress.

Robdel12 avatar Robdel12 commented on June 13, 2024

πŸ‘‹πŸΌ This seems to be an issue with how TypeScript is bundling the tests together. We ship a different version of the logger for browsers and node. For some reason, the node version is being pulled in and then polyfilled since it’s a node API.

Did this start happening with a specific version of typescript? Or has this always been an issue?

from percy-cypress.

ayaanqui avatar ayaanqui commented on June 13, 2024

For me this wasn't always the case, tests used to work fine. The errors started after upgrading for sure, but I'm not entirely sure from what version exactly

from percy-cypress.

dharani420 avatar dharani420 commented on June 13, 2024

even i have noticed this issue after upgrading to cypress version 8, I tried to downgrade the cypress version to 7.7.0 , still issue persists. not sure what went wrong. Please suggest me on this issue . Thanks in advance!

from percy-cypress.

Robdel12 avatar Robdel12 commented on June 13, 2024

We won't have time to really dig in until next week, but it's not an issue with Cypress. Looks to be an issue with TypeScript / how tests are being bundled. Might be worth downgrading TypeScript to see where/if the error goes away

from percy-cypress.

stbth01 avatar stbth01 commented on June 13, 2024

I'm getting this now too, I just updated to cypress version 10 and bumped the percy sdk to the latest before that update I was getting the 'isTTY" message.

from percy-cypress.

wwilsman avatar wwilsman commented on June 13, 2024

This is a dependency resolution issue within your project's build tool that can't be fixed by us.

node_modules/@percy/sdk-utils/dist/logger.js

This is a Node export for the package, but you are using it in a Cypress browser, which is why you are seeing an error when it tries to access Node things.

The correct file for browsers should be node_modules/@percy/sdk-utils/dist/bundle.js. The package.json for the @percy/sdk-utils project correctly defines this as the browser bundle with all other exports being meant for Node.

https://github.com/percy/cli/blob/497772c62e2fa2d763b350c40a0cfec918f7125f/packages/sdk-utils/package.json#L23-L28

So if the dependency resolution in your project is getting this wrong, then whatever tool is being used in your project is not correctly using these package.json standards (or is not configured to prefer browser bundles over Node entrypoints).

Closing this now since this isn't a bug on our end

from percy-cypress.

stbth01 avatar stbth01 commented on June 13, 2024

This issue keeps coming up for us and we just try the workflow but I have been asked to review it again. I'm not sure I understand you point that is its a dependency issue because for us it will take several sshots then hit this error, if it was a dependency issue would we hit it in the first go or hit it all the time (we often can re-try and it will work)

image

from percy-cypress.

AtofStryker avatar AtofStryker commented on June 13, 2024

@stbth01 I ran into this while trying to update some repositories within Cypress that leverage Percy integration. You likely need to set __PERCY_BROWSERIFIED__ for sdk-utils to be aware that it isn't running in node.js. You can do that in webpack like this:

plugins: [
 new webpack.DefinePlugin({
    'process.env.__PERCY_BROWSERIFIED__': true
  })
]

from percy-cypress.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.