-
-
Notifications
You must be signed in to change notification settings - Fork 35k
Description
another one for the test runner:
Description
Using child_process for test parallisation also sets process.stdout.isTTY to undefined.
The following returns undefined when it's run with node --test:
# node --test example.test.js
console.log(process.stdout.isTTY)
# undefinedwhen it's run with plain node, it's true:
# node example.test.js
console.log(process.stdout.isTTY)
# trueI had a very faint memory of a similar issue described by someone else,
very similar to this and IIRC about the child_process.
So, I run the same with --experimental-test-isolation=none and there it is: it returns true which confirms my suspicions.
# node --test --experimental-test-isolation=none example.test.js
console.log(process.stdout.isTTY)
# trueAlthough you can work around it, it's very problematic for the following reasons:
- It's inconsistent with POLA
- It' inconsistent with it's own API because it reports one way with one flag, and another without.
- It leaks implementation details
How the tests are run is an implementation detail that shouldn't be leaking like that.
I'm sure there are some valid reasons for it but this feels plain wrong.
Thoughts?
Note: I only suspect these 2 issues are related.