You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed while working on integrating k6-jslib-testing that both the --no-color flag and the NO_COLOR environment variables when used, do disable colors, but also changes the logging format of console.log.
The following script:
exportdefaultfunctionmain(){console.log("\x1b[31mhello\n\x1b[0mworld!");// ANSI codes marking hello as red color}
Ran with k6 run script.js results in the following output:
But ran with NO_COLOR k6 run script.js or k6 run --no-color script.js results in the following output:
Whereas I would have expected for the output to be aligned with the colored one, just, without colors:
INFO[0000] hello
world! source=console
Maybe this was the intended behavior, and there might be justifications for it being this way. But as it didn't align with my expectations and assumptions as a user, and I couldn't find more context about this besides the initial PR for NO_COLOR, I thought I would still open a bug to give a shot at addressing that, or at the bottom line, document why it works this way.
k6 version
v0.56.0
OS
macOS
Docker version and image (if applicable)
No response
Steps to reproduce the problem
Script:
export default function main() {
console.log("\x1b[31mhello\n\x1b[0mworld!");
}
Brief summary
I've noticed while working on integrating k6-jslib-testing that both the
--no-color
flag and theNO_COLOR
environment variables when used, do disable colors, but also changes the logging format ofconsole.log
.The following script:
Ran with
![Image](https://private-user-images.githubusercontent.com/690867/409536315-34563ea4-1a90-4206-b418-46e607aa4173.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5OTEyNjMsIm5iZiI6MTczODk5MDk2MywicGF0aCI6Ii82OTA4NjcvNDA5NTM2MzE1LTM0NTYzZWE0LTFhOTAtNDIwNi1iNDE4LTQ2ZTYwN2FhNDE3My5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOFQwNTAyNDNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iMTc0ZDRjZTUyMWU2YjhjNWZjOGRkYTcxNzMxZDI2OTEyYTc2MDI3ZjYzZjY2NDdkMjg1ZTY1MDAyYzBlNzRlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.jALfUAnK9jXUO9kRysf4-9OYunW80Ge3fE7yiFshV_k)
k6 run script.js
results in the following output:But ran with![Image](https://private-user-images.githubusercontent.com/690867/409536641-62ffb264-cb36-4fa1-a399-96c1b8d1a97c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5OTEyNjMsIm5iZiI6MTczODk5MDk2MywicGF0aCI6Ii82OTA4NjcvNDA5NTM2NjQxLTYyZmZiMjY0LWNiMzYtNGZhMS1hMzk5LTk2YzFiOGQxYTk3Yy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOFQwNTAyNDNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04NzMzOGZmNGFjN2YwOWZiZDJjOTIwM2NiZGVmMmY5ZjBhMGJlM2NkZDJjNjllYjk2Y2ExYzJlMWUyYWRmYTY4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.l7iburpaeMlVm6il3AQfI6BJYcB40mxGbxk8H2dEkGg)
NO_COLOR k6 run script.js
ork6 run --no-color script.js
results in the following output:Whereas I would have expected for the output to be aligned with the colored one, just, without colors:
Maybe this was the intended behavior, and there might be justifications for it being this way. But as it didn't align with my expectations and assumptions as a user, and I couldn't find more context about this besides the initial PR for NO_COLOR, I thought I would still open a bug to give a shot at addressing that, or at the bottom line, document why it works this way.
k6 version
v0.56.0
OS
macOS
Docker version and image (if applicable)
No response
Steps to reproduce the problem
Script:
Command:
Expected behaviour
(not colorized)
Actual behaviour
The text was updated successfully, but these errors were encountered: