question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError on cypress open tty.getWindowSize

See original GitHub issue

Is 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:closed
  • Created 5 years ago
  • Reactions:15
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
jennifer-shehanecommented, May 31, 2018

Fixed in 3.0.1.

1reaction
brian-manncommented, May 31, 2018

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 a tty.

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 on tty 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…

function () { 
  return [this.columns, this.rows]
}

HOWEVER! this.columns and this.rows will be undefined in node so we have to polyfill those too! Lucky we use term-size and already have a lib wrapper around that so we can just use that…

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found