`setRawMode` error on exit
See original GitHub issueWhen 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:
- Created 7 years ago
- Reactions:1
- Comments:8 (6 by maintainers)
Top 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 >
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 Free
Top 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

To add additional context, I noticed that this only happens in
devmode when the configuration file has thereport_fileproperty 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 callsetRawMode(false)[3], which in turns callssetRawModeonprocess.stdinas we only have oneprocess.stdinthe second time we callsetRawModeit’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:
devmode, don’t allow for a second reporter to be created, as thedevreporter is not able to log to a file anyways. See how theoutargument is ignored in the constructor [4];report_fileis set and we are indevmode, then log to a file using the regulartapreporter.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
I think the 2nd would make the most sense, cc @stefanpenner