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.

`setRawMode` error on exit

See original GitHub issue

When I am using TestEm in development mode ( testem ), I get the following error when I press q to quit:

[Press ENTER to run tests; q to quit; p to pause]                                                                                                                                                                                                                                      q
/Users/pelletn/<MyProject>/node_modules/bluebird/js/release/using.js:12
        setTimeout(function(){throw e;}, 0);
                              ^

TypeError: Cannot read property 'setRawMode' of null
    at ReadStream.setRawMode (tty.js:38:15)
    at module.exports.View.extend.setRawMode (/Users/pelletn/<MyProject>/node_modules/testem/lib/reporters/dev/index.js:333:21)
    at module.exports.View.extend.cleanup (/Users/pelletn/<MyProject>/node_modules/testem/lib/reporters/dev/index.js:398:10)
    at module.exports.View.extend.finish (/Users/pelletn/<MyProject>/node_modules/testem/lib/reporters/dev/index.js:388:10)
    at /Users/pelletn/<MyProject>/node_modules/testem/lib/utils/reporter.js:101:22
    at Array.forEach (native)
    at Reporter.finish (/Users/pelletn/<MyProject>/node_modules/testem/lib/utils/reporter.js:99:20)
    at Reporter.close (/Users/pelletn/<MyProject>/node_modules/testem/lib/utils/reporter.js:77:8)
    at Reporter.<anonymous> (/Users/pelletn/<MyProject>/node_modules/testem/lib/utils/reporter.js:72:21)
    at FunctionDisposer.doDispose (/Users/pelletn/<MyProject>/node_modules/bluebird/js/release/using.js:98:19)
    at FunctionDisposer.Disposer.tryDispose (/Users/pelletn/<MyProject>/node_modules/bluebird/js/release/using.js:78:20)
    at iterator (/Users/pelletn/<MyProject>/node_modules/bluebird/js/release/using.js:36:53)
    at dispose (/Users/pelletn/<MyProject>/node_modules/bluebird/js/release/using.js:48:9)
    at /Users/pelletn/<MyProject>/node_modules/bluebird/js/release/using.js:194:20
    at PassThroughHandlerContext.finallyHandler (/Users/pelletn/<MyProject>/node_modules/bluebird/js/release/finally.js:55:23)
    at PassThroughHandlerContext.tryCatcher (/Users/pelletn/<MyProject>/node_modules/bluebird/js/release/util.js:16:23)

Here is the end of the log if I try testem --debug to see what happened:

WARN node_dev closed 0
info node_dev onEnd
info node_dev onEnd
info Got keyboard Quit command
info Got keyboard Quit command
info Stopping dev
info Closing browser PhantomJS.
WARN PhantomJS closed 1
info Process PhantomJS terminated. 1 null

I am on MacOX 10.11.6 Node: v6.3.1 Npm: 3.10.3

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
ventunocommented, Aug 13, 2018

To add additional context, I noticed that this only happens in dev mode when the configuration file has the report_file property set.

In this case two reporters (both of type dev [1]) will be created [2]. When tests finish, as part of the cleanup process we call setRawMode(false) [3], which in turns calls setRawMode on process.stdin as we only have one process.stdin the second time we call setRawMode it’s called on a null object.

This seems to be a simple enough fix which I’m happy to tackle myself, we just need to agree on the right solution, a few ideas:

  1. If running in dev mode, don’t allow for a second reporter to be created, as the dev reporter is not able to log to a file anyways. See how the out argument is ignored in the constructor [4];
  2. If report_file is set and we are in dev mode, then log to a file using the regular tap reporter.

What do you think? cc @johanneswuerbach.

[1] https://github.com/testem/testem/blob/master/lib/reporters/dev/index.js [2] https://github.com/testem/testem/blob/master/lib/utils/reporter.js#L51 [3] https://github.com/testem/testem/blob/master/lib/reporters/dev/index.js#L318 [4] https://github.com/testem/testem/blob/master/lib/reporters/dev/index.js#L31

0reactions
johanneswuerbachcommented, Aug 20, 2018

I think the 2nd would make the most sense, cc @stefanpenner

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'setRawMode' of null · Issue #41330 · ...
Node in terminal window gives error - Cannot read property 'setRawMode' of null # ... show false; set terminal in not 'raw' mode;...
Read more >
process.stdin.setRawMode(true) is not a function
I am trying to buid a snake game using node with the command line, and I am having an error : process.stdin.setRawMode(true); ^...
Read more >
Node.js readStream.setRawMode() Method
The readStream.setRawMode() method is an inbuilt application programming interface of class ReadStream within 'tty' module which is used to set ...
Read more >
Readline | Node.js v19.3.0 Documentation
Errors in the input stream are not forwarded. If the loop is terminated with break , throw , or return , rl.close() will...
Read more >
non-tty console : WEB-1933
setRawMode ()` instead. tty.js:37 throw new Error('can\'t set raw mode on ... _tickCallback (node.js:244:9) Process finished with exit code 1 at 12:09:41.
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