percy-cypress: [TypeScript] percySnapshot - TypeError: Cannot read properties of undefined (reading 'isTTY')
The problem
Running percy exec -- cypress run
gives me the following errors:
TypeError: Cannot read properties of undefined (reading 'isTTY')
at PercyLogger.write (http://localhost:3000/__cypress/tests?p=cypress/support/index.js:5511:27)
at PercyLogger.log (http://localhost:3000/__cypress/tests?p=cypress/support/index.js:5498:12)
at Object.isPercyEnabled (http://localhost:3000/__cypress/tests?p=cypress/support/index.js:5839:11)
at async Context.eval (http://localhost:3000/__cypress/tests?p=cypress/support/index.js:5148:10)
I was able to narrow down where the error/failed tests were stemming from, and it looks like all my tests pass if I comment out lines where I’m using percyScreenshot
. The odd thing is that running cypress open
works fine and passes all tests as expected.
Environment
- Node version:
14.18.0
@percy/cli
version:1.0.0-beta.70
- Version of Percy SDK you’re using:
- If needed, a build or snapshot ID:
- OS version:
- Type of shell command-line [interface]:
Code to reproduce issue
The error occurs exactly at line 7
, so removing/deleting that line (cy.percySnapshot(...
) results in a passing test.
const screenWidths = [375, 768, 1280]
describe("ordering stocks", () => {
it("should visit homepage", () => {
cy.visit("/")
cy.findByText(/My text/)
cy.percySnapshot("DSC homepage", { widths: screenWidths })
})
})
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 19 (6 by maintainers)
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.
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/*
Any ideas?
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.