--stream prints newlines as \n
See original GitHub issueExpected Behavior
I run my tests with lerna run --stream test
, the packages tests are simple Jest tests.
The output printed by Lerna doesn’t properly renders the newlines, for instance, this is what I get:
Possible Solution
I’m not sure, but it looks like Lerna does something to escape the special characters and forgets to restore them before it prints.
Steps to Reproduce (for bugs)
- create a
package/something
with inside itspackage.json
a Jest test command - run
lerna run --stream test
in the root of the project
lerna.json
{
"lerna": "2.1.1",
"packages": [
"packages/*"
],
"version": "independent",
"npmClient": "yarn"
}
lerna-debug.log
<!-- If you have a `lerna-debug.log` available, please paste it here -->
<!-- Otherwise, feel free to delete this <details> block -->
Context
This bug makes it very difficult to read the logs, especially in CI
Your Environment
Executable | Version |
---|---|
lerna --version |
2.1.1 |
npm --version |
5.3.0 |
yarn --version |
1.0.0-20170815.1425 |
node --version |
8.1.2 |
OS | Version |
---|---|
macOS | 10.12.6 |
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:18 (4 by maintainers)
Top Results From Across the Web
java stream 8, every sixth word print in new line
Now I have all results in one line. How I can make logic in this Java stream 8, to put every 5 words...
Read more >Python New Line and How to Python Print Without a Newline
The new line character in Python is \n . It is used to indicate the end of a line of text. You can...
Read more >Creating a New Line in C++
Learn C++ Online With Udacity ... As a programmer, you can use endl or \n to create new line commands in C++. These...
Read more >Python New Line: How to Print WITHOUT Newline in Python
From Python 3+, there is an additional parameter introduced for print() called end=. This parameter takes care of removing the newline that is ......
Read more >Python: How to Print Without Newline?
To print without a newline, all you have to do is add an additional argument at the end of your print statement. This...
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
This also happens with
lerna run --parallel
I also ran into this, but it seems to be an issue primarily with
jest
. Relevant issues:jest
’sBaseReporter
writes output tostderr
instead ofstdout
. See here.Since
lerna run
collapses newlines forstderr
viastrong-log-transformer
, we end up with escaped newlines in the output. https://github.com/lerna/lerna/blob/d35c7aa0875013248f55b26487eac99d55b59a78/src/ChildProcessUtilities.js#L52I’m not entirely sure why this is
jest
’s default behavior since it doesn’t seem to be consistent with other test runners (notablymocha
). As such, I think the fix probably belongs injest
and not inlerna
.Removing
mergeMultiline
inlerna
might not break anything (--parallel
?), but it seems like it could also have larger implications sincelerna run
is not limited to running tests.There is a very simple workaround to perform the redirection to
stdout
in bash, though this still probably won’t work well with CI tools that read fromstderr
to determine build failures.