Closed
Description
Brief summary
When we add the handleSummary() function to our test files, the output log differs from the default console log that is printed when handleSummary() is not used.
return {
stdout: textSummary(data, { indent: ' ', enableColors: true })
};
k6 version
1.0
OS
Windows
Docker version and image (if applicable)
No response
Steps to reproduce the problem
import http from 'k6/http'
import { check, sleep } from 'k6'
import { textSummary } from 'https://jslib.k6.io/k6-summary/0.0.1/index.js';
export const options = {
vus: 1,
duration: '30s',
thresholds: {
// Fail the test if the average response time is greater than 200ms
http_req_duration: ['avg<2000'],
},
}
export default function () {
const res = http.get('https://test.k6.io')
sleep(1)
check(res, {
'response status is 404': (r) => r.status === 404, // This will fail since the status is 200
})
}
export function handleSummary(data: any) {
return {
stdout: textSummary(data, { indent: ' ', enableColors: true })
};
}
Run this test with k6 run --summary-mode=full test.js
and see the out out
Expected behaviour
The out put should be same as when handleSummary() is not added.
Actual behaviour
The output is in old format.