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

debug.js colour and logging behaviour changed with the upgrade to v2 #1638

Closed
noway opened this issue Nov 24, 2019 · 9 comments · Fixed by okikio/science-app#2 or nodeshift-starters/opossum-examples#15 · May be fixed by alektobias/Generic-company-management-API#2

Comments

@noway
Copy link

noway commented Nov 24, 2019

  • nodemon -v: 2.0.1
  • node -v:v12.6.0
  • Operating system/terminal environment: Mac OS Catalina 10.15.1, iTerm 2 3.3.7
  • Using Docker? What image: no
  • Command you ran: nodemon

Expected behaviour

image

Actual behaviour

image

Steps to reproduce

use debug.js on v1 and v2. on v1 logging suffixes and colour shown on all lines, on v2 logging suffixes shown only on first colour with no colour.


If applicable, please append the --dump flag on your command and include the output here ensuring to remove any sensitive/personal details or tokens.

@remy
Copy link
Owner

remy commented Nov 24, 2019

I think I know why this is, but can you provide a sample repo (reduced down as much as possible) so that I can replicate against?

@noway
Copy link
Author

noway commented Nov 25, 2019

thank you for response, sorry don't have enough bandwidth for that 😥

@remy
Copy link
Owner

remy commented Nov 26, 2019

Well, same here, but can you at least share some part of your code so that someone else has a chance of replicating what colour lib you're using?

@noway
Copy link
Author

noway commented Nov 26, 2019

made a repro repo here: https://github.com/noway/debugjsnodemonbug

how it should look:
image

how it looks in v2:
image

debug.js colours stuff itself by the looks of it

@gilles-crealp
Copy link

Same problem here, since 2.0.1 (not in 2.0.0). The problem is with the package supportsColor. It now return false with supportsColor.stderr (but not with supportsColor.stdout).

@gilles-crealp
Copy link

I think I know why this is, but can you provide a sample repo (reduced down as much as possible) so that I can replicate against?

const supportsColor = require('supports-color')
if (supportsColor.stdout) {
  console.log('Terminal stdout supports color')
} else {
  console.log('Terminal stdout DO NOT supports color')
}
if (supportsColor.stderr) {
  console.log('Terminal stderr supports color')
} else {
  console.log('Terminal stderr DO NOT supports color')
}

With nodemon@2.0.0

Terminal stdout supports color
Terminal stderr supports color

With nodemon@2.0.1

Terminal stdout supports color
Terminal stderr DO NOT supports color

@remy
Copy link
Owner

remy commented Nov 27, 2019

Perfect replication info - thank you. Will pick up, I know the change that's triggered this issue.

@remy
Copy link
Owner

remy commented Nov 29, 2019

I've been able to get a fix for this, but I need to write a test to show it happening and show it's fixed (so it doesn't reoccur).

@remy remy closed this as completed in 47dfb8b Dec 4, 2019
@remy
Copy link
Owner

remy commented Dec 4, 2019

Waiting on nodemon@2.0.2 - going up now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment