stdout is not a tty. Using bash for node + tape + tap-spec

FreddyNoNose picture FreddyNoNose · Aug 26, 2017 · Viewed 16.1k times · Source

Was looking at a tape + tap video and tried to get it to work.
OS: Windows 7 Git Bash Shell

node main.js | ./node_modules/.bin/tap-spec

stdout is not a tty.

main.js:

var test = require('tape');
var add = require('./add');

test('add: two numbers add correctly', function(t) {
var actual = add(1,2);
var expected = 3;
t.equal(actual, expected);
t.end();
});

add.js:

module.exports = function(a, b) {
return a + b;
};

winpty node main.js | ./node_modules/.bin/tap-spec doesn't fix the problem.

Answer

Thomas Urban picture Thomas Urban · Jun 23, 2020

Just to add my case, I was facing similar issue. Neither solution of using winpty did help, thus I used different hint on using node.exe instead of node when running a script (from Git bash in my case).

not working:

node myscript.js < some-input.txt > some-output.txt

working:

node.exe myscript.js < some-input.txt > some-output.txt