textSummary not producing the same output as the default output

I am trying to make an K6 integration in an Azure devops pipeline. To do this I use HandleSummary to make an Junit report to upload to Azure (Load Testing with Azure DevOps and k6 | by Ivan Porta | Microsoft Azure | Medium). Also I write the result to STDOUT to see the result in the console.

Only the result in the console is different when I use HandleSummary than with the default output. Can anyone help with this? The default one is much easier to read.

Default output:


Code in script:

export function handleSummary(data) {

// create a Junit file for test results
return {
stdout: textSummary(data, { enableColors: true }),
'./junit.xml': jUnit(data),
'./summary.json': JSON.stringify(data),

This is because you have explicitly passed enableColors: true to textSummary(), when the stdout isn’t a terminal and doesn’t support colors in the output.

For reference, here is how k6 determines the value of enableColors when it generates the default text summary itself - it only enables them when stdout is a TTY and when they haven’t been explicitly disabled with --no-color.

1 Like

Thank you for your help, without enableColors: true I still get te wrong result, but when I set enableColors: false it works perfect for me :).