Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log verbose mode #2671

Closed
4 tasks done
jcalfee opened this issue Jan 15, 2023 · 6 comments
Closed
4 tasks done

Log verbose mode #2671

jcalfee opened this issue Jan 15, 2023 · 6 comments

Comments

@jcalfee
Copy link

jcalfee commented Jan 15, 2023

Clear and concise description of the problem

During development there are times when it is essential to see all of the console log and error messages. I tried many things and none seem to work in all cases: large outputTruncateLength, using json reporter. At one point I found it necessary to redirect the npm debug package from process.stdout because it uses process.stderr was suppressed.

I'm glad so much is being done to clean up the output, but I do see an ongoing need, from now on, to by-pass this in the early stages development.

Suggested solution

Add a verbose-log cli option that ensures messages to process.stdout and process.stderr always pass-through.

Alternative

No response

Additional context

No response

Validations

@jcalfee
Copy link
Author

jcalfee commented Mar 15, 2023

Why does maximum truncated output not work? What is the logic here?

@sheremet-va
Copy link
Member

Do you have a reproduction? I don't understand your problem.

@jcalfee
Copy link
Author

jcalfee commented Mar 15, 2023

It is just stderr.. Stdout seams to always print everything. I tend to rely on the debug package which uses stderr as its default output stream. But I get into situations under vitest where the stderr is truncated even if I set a large outputTruncateLength value. The only work-around I have is to change code to use stdout. Sometimes that is easy, but it is not always.

@sheremet-va
Copy link
Member

It is just stderr.. Stdout seams to always print everything. I tend to rely on the debug package which uses stderr as its default output stream. But I get into situations under vitest where the stderr is truncated even if I set a large outputTruncateLength value. The only work-around I have is to change code to use stdout. Sometimes that is easy, but it is not always.

A lot of words but no code. Please, give me something to run

@jcalfee
Copy link
Author

jcalfee commented Mar 16, 2023

import {test} from 'vitest'

/** <code>
vitest run --outputTruncateLength 9999 tests/stderr.test.js  # ends at: ,99986,9998
vitest run --outputTruncateLength 9999999 tests/stderr.test.js  # ends at: ,99986,9998
</code>*/
test('stderr', async function() {
  for(let i = 0; i <= 100000; i++) {
    process.stderr.write(i + ',')
  }
})

// Copy and paste the for loop in the node cli, it ends in: 99999,100000,true

// process.stdout is also truncated

@sheremet-va
Copy link
Member

Vitest doesn't truncate anything written via process.stderr/process.stdout. This is Node.js behavior as far as I understand.

@jcalfee jcalfee closed this as completed Jun 4, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jun 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants