TypeError on cypress open tty.getWindowSize
See original GitHub issueIs this a Feature or Bug?
Bug
Current behavior:
On cypress open
, some users are getting TypeError on new update to 3.0.0
TypeError: tty.getWindowSize is not a function
at Object.<anonymous> (C:\Users\Ladder Digital\AppData\Local\Cypress\Cache\3.0.0\Cypress\resources\app\packages\server\node_modules\mocha\lib\reporters\base.js:120:13)
at Object.<anonymous> (C:\Users\Ladder Digital\AppData\Local\Cypress\Cache\3.0.0\Cypress\resources\app\packages\server\node_modules\mocha\lib\reporters\base.js:489:3)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\Ladder Digital\AppData\Local\Cypress\Cache\3.0.0\Cypress\resources\app\packages\server\node_modules\mocha\lib\reporters\index.js:3:31)
at Object.<anonymous> (C:\Users\Ladder Digital\AppData\Local\Cypress\Cache\3.0.0\Cypress\resources\app\packages\server\node_modules\mocha\lib\reporters\index.js:21:3)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\Ladder Digital\AppData\Local\Cypress\Cache\3.0.0\Cypress\resources\app\packages\server\node_modules\mocha\lib\mocha.js:13:17)
at Object.<anonymous> (C:\Users\Ladder Digital\AppData\Local\Cypress\Cache\3.0.0\Cypress\resources\app\packages\server\node_modules\mocha\lib\mocha.js:504:3)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\Ladder Digital\AppData\Local\Cypress\Cache\3.0.0\Cypress\resources\app\packages\server\node_modules\mocha\index.js:3:5)
at Object.<anonymous> (C:\Users\Ladder Digital\AppData\Local\Cypress\Cache\3.0.0\Cypress\resources\app\packages\server\node_modules\mocha\index.js:5:3)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\Ladder Digital\AppData\Local\Cypress\Cache\3.0.0\Cypress\resources\app\packages\server\lib\reporter.js:11:11)
at Object.<anonymous> (C:\Users\Ladder Digital\AppData\Local\Cypress\Cache\3.0.0\Cypress\resources\app\packages\server\lib\reporter.js:402:4)
at Object.<anonymous> (C:\Users\Ladder Digital\AppData\Local\Cypress\Cache\3.0.0\Cypress\resources\app\packages\server\lib\reporter.js:404:3)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\Ladder Digital\AppData\Local\Cypress\Cache\3.0.0\Cypress\resources\app\packages\server\lib\project.js:49:14)
at Object.<anonymous> (C:\Users\Ladder Digital\AppData\Local\Cypress\Cache\3.0.0\Cypress\resources\app\packages\server\lib\project.js:654:4)
at Object.<anonymous> (C:\Users\Ladder Digital\AppData\Local\Cypress\Cache\3.0.0\Cypress\resources\app\packages\server\lib\project.js:656:3)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anon
Desired behavior:
No TypeError 😃
Steps to reproduce:
.node_modules\.bin\cypress open
Versions
Cypress: 3.0.0 OSes observered: Windows 10 Pro, Windows 8.1, Windows 7
Issue Analytics
- State:
- Created 5 years ago
- Reactions:15
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Changelog - Cypress Documentation
"Open in IDE" is no longer displayed in the command log for component tests. ... clearLocalStorage({ log:false }) no longer throws a type...
Read more >How to get window size with Cypress? - Stack Overflow
It depends on how you are using viewPorts. If you are using cy.viewport(...) command, then you are easily able to store arguments to...
Read more >cypress: Versions - Openbase
Fixed a regression in 9.2.0 to keep Cypress open after each spec finishes when ... so Cypress will no longer throw TypeError: Expected...
Read more >WORD FREQUENCY - Michael Dickens - PDF Free Download
Open Print Download Current View. Go to First Page Go to Last Page ... fishy panther unchangeable controllable tty proxies collide connectivity kelsey...
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
Fixed in
3.0.1
.Okay I understand the root cause. When spawning a process in electron in Windows
isTTY
is always false as per these electron tests…https://github.com/electron/electron/pull/7143/files#diff-772c67b73618ae46d1b7e8b22e1ec85cR240
What’s happening is that we are actually tricking / forcing the electron/node process to believe that windows is in fact a
tty
. This changed in 3.0 and it’s important because we want things like terminal windows + reporters to color text and think we are atty
.Mocha is using an undocumented method on
node
to try to figure out the window size, and because we don’t monkey patch this it falls through to the second check - which apparently is using a method ontty
that has never existed and is a bug in mocha.To fix this we’ll need to polyfill the actual method in
node
in Windows which is…HOWEVER!
this.columns
andthis.rows
will be undefined innode
so we have to polyfill those too! Lucky we useterm-size
and already have a lib wrapper around that so we can just use that…