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
When using the official htmlReport from k6/html to generate a report and appending custom HTML content (e.g., a table of abnormal requests), a TypeError: Value is not an object: undefined is thrown. Switching to the third-party k6-reporter module resolves the issue, suggesting a potential bug or limitation in the official htmlReport implementation.
k6 version
v0.58
OS
Windows 10
Docker version and image (if applicable)
No response
Steps to reproduce the problem
Steps to reproduce the problem
Create a k6 script that generates some metrics and logs abnormal requests (e.g., requests with duration > 1000ms).
In the handleSummary function, use the official htmlReport to generate a default report:
import { htmlReport } from 'k6/html';
export function handleSummary(data) {
const defaultReport = htmlReport(data, { title: "WEB Test Report" });
const customContent = "
The htmlReport function should generate a report, and appending custom HTML content (e.g., a table) to the report should not throw an error. The final report should include both the default metrics generated by htmlReport and the custom content.
Actual behaviour
When appending custom content to the report generated by htmlReport, the following error is thrown:
TypeError: Value is not an object: undefined
The error occurs during the execution of htmlReport(data, { title: "WEB Test Report" }) or when modifying the report string. However, if I switch to the third-party k6-reporter module by changing the import to:
the error no longer occurs, and the custom content is successfully appended to the report.
Additional Notes
The data object passed to htmlReport is valid and contains expected fields like metrics, state, and root_group (I can provide the full data log if needed).
The issue might be related to how the official htmlReport handles the Web Dashboard data or its internal HTML structure, as the third-party k6-reporter does not exhibit this problem.
I suspect the official htmlReport may not support appending custom content to its generated report, or there might be a bug in its implementation.
The text was updated successfully, but these errors were encountered:
Brief summary
When using the official htmlReport from k6/html to generate a report and appending custom HTML content (e.g., a table of abnormal requests), a TypeError: Value is not an object: undefined is thrown. Switching to the third-party k6-reporter module resolves the issue, suggesting a potential bug or limitation in the official htmlReport implementation.
k6 version
v0.58
OS
Windows 10
Docker version and image (if applicable)
No response
Steps to reproduce the problem
Steps to reproduce the problem
Create a k6 script that generates some metrics and logs abnormal requests (e.g., requests with duration > 1000ms).
In the handleSummary function, use the official htmlReport to generate a default report:
import { htmlReport } from 'k6/html';
export function handleSummary(data) {
const defaultReport = htmlReport(data, { title: "WEB Test Report" });
const customContent = "
Custom Section
Test
";const bodyEndIndex = defaultReport.lastIndexOf('');
const modifiedReport = defaultReport.slice(0, bodyEndIndex) + customContent + defaultReport.slice(bodyEndIndex);
return { 'report.html': modifiedReport };
}
Run the script with the k6_web_dashboard option
Observe the error in the console output.
Expected behaviour
The htmlReport function should generate a report, and appending custom HTML content (e.g., a table) to the report should not throw an error. The final report should include both the default metrics generated by htmlReport and the custom content.
Actual behaviour
When appending custom content to the report generated by htmlReport, the following error is thrown:
TypeError: Value is not an object: undefined
The error occurs during the execution of htmlReport(data, { title: "WEB Test Report" }) or when modifying the report string. However, if I switch to the third-party k6-reporter module by changing the import to:
import { htmlReport } from 'https://raw.githubusercontent.com/benc-uk/k6-reporter/main/dist/bundle.js';
the error no longer occurs, and the custom content is successfully appended to the report.
Additional Notes
The data object passed to htmlReport is valid and contains expected fields like metrics, state, and root_group (I can provide the full data log if needed).
The issue might be related to how the official htmlReport handles the Web Dashboard data or its internal HTML structure, as the third-party k6-reporter does not exhibit this problem.
I suspect the official htmlReport may not support appending custom content to its generated report, or there might be a bug in its implementation.
The text was updated successfully, but these errors were encountered: