Nodemon: debug.js colour and logging behaviour changed with the upgrade to v2

Created on 24 Nov 2019  路  9Comments  路  Source: remy/nodemon

  • 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.

Most helpful comment

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).

All 9 comments

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?

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

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?

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

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).

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 [email protected]

Terminal stdout supports color
Terminal stderr supports color

With [email protected]

Terminal stdout supports color
Terminal stderr DO NOT supports color

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

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).

Waiting on [email protected] - going up now

Was this page helpful?
0 / 5 - 0 ratings