[TypeScript] percySnapshot - TypeError: Cannot read properties of undefined (reading 'isTTY')
See original GitHub issueThe 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 })
})
})
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:17 (6 by maintainers)
Top Results From Across the Web
TypeError: Cannot read property 'isTTY' of undefined
I have installed twilio latest version in my angular project. But when the project runs, it says that "Cannot read property 'isTTY' of...
Read more >cannot read properties of undefined (reading 'snapshot')
When I call toMatchImageSnapshot() function, it will give me the below error. TypeError: Cannot read properties of undefined (reading '_counters'). Open side ...
Read more >How to Avoid the Infamous "Cannot read properties of ... - Bitovi
With TypeScript, there are two ways of interpreting null and undefined ... avoid the 'Cannot read properties of undefined' runtime TypeError.
Read more >Prevent “Cannot read property '…' of undefined” errors with ...
Every developer who did some JavaScript has got errors like “Cannot read property '…' of undefined”. There is one simple way to prevent...
Read more >percy-cypress - bytemeta
[TypeScript] percySnapshot - TypeError: Cannot read properties of undefined (reading 'isTTY'). Previous Next. Make software development more efficient, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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?