Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use node.js and ANSIcolor plugin in Jenkins

I want to display colored output in jenkins which is produced by node.js

Both work separately, but not combined:

Node Script My test script test.js:

console.log(require("chalk").red("Node Red"))

Calling the test script in the shell works:

node test.js => OK

Calling a colored shell script in jenkins works:

echo -e "\033[31mShell Red\033[0m" => OK

But calling the node script in jenkins does not display any colors:

node test.js => No Color, when executed in jenkins
like image 389
Matthias M Avatar asked Sep 19 '25 07:09

Matthias M


1 Answers

For me it worked when putting

export FORCE_COLOR=1

at the top of my script.

See https://github.com/chalk/supports-color#info

like image 140
Raphael Schweikert Avatar answered Sep 20 '25 23:09

Raphael Schweikert