Files
chromedevtools__chrome-devt…/tests/formatters/IssueFormatter.test.js.snapshot
Natasha Gorshunova b24731572f fix: fix formatter bugs (#2552)
This PR is created on top of PR #2519 and addresses two formatter bugs
discovered during review:

ConsoleFormatter bug: When a console log has an empty message text but
contains arguments, the formatter correctly shifts the first argument
out of the arguments list to serve as the message text. However, it
never sets the text field to this shifted argument, causing the first
argument to be completely lost in the output.

IssueFormatter bug: When a concise issue has no description, the
formatting helper prints the literal string "undefined" instead of
falling back to "Unknown Issue".

Closes #2519

---------

Co-authored-by: ZayanKhan-12 <khanzayan200@gmail.com>
2026-08-11 13:08:45 +00:00

118 lines
2.7 KiB
Plaintext

exports[`IssueFormatter > formats a detailed issue toJSONDetailed 1`] = `
{
"id": 5,
"type": "issue",
"title": "Mock Issue Title",
"description": "# Mock Issue Title\\n\\nThis is a mock issue description sub value",
"links": [
{
"link": "http://example.com",
"linkTitle": "Link 1"
}
],
"affectedResources": [
{
"uid": "1_1",
"data": {
"violatingNodeAttribute": "test"
}
}
]
}
`;
exports[`IssueFormatter > formats a detailed issue toStringDetailed 1`] = `
ID: 5
Message: issue> Mock Issue Title
This is a mock issue description sub value
Learn more:
[Link 1](http://example.com)
### Affected resources
uid=1_1 data={"violatingNodeAttribute":"test"}
`;
exports[`IssueFormatter > formats a detailed issue with a resolved request id toJSONDetailed 1`] = `
{
"id": 6,
"type": "issue",
"title": "Mock Issue Title",
"description": "# Mock Issue Title\\n\\nThis is a mock issue description",
"links": [],
"affectedResources": [
{
"data": {
"request": {
"url": "http://example.com/data.json"
}
},
"request": 42
}
]
}
`;
exports[`IssueFormatter > formats a detailed issue with a resolved request id toStringDetailed 1`] = `
ID: 6
Message: issue> Mock Issue Title
This is a mock issue description
### Affected resources
reqid=42 data={"request":{"url":"http://example.com/data.json"}}
`;
exports[`IssueFormatter > formats a detailed issue with an unresolved request id toJSONDetailed 1`] = `
{
"id": 7,
"type": "issue",
"title": "Mock Issue Title",
"description": "# Mock Issue Title\\n\\nThis is a mock issue description",
"links": [],
"affectedResources": [
{
"data": {
"request": {
"url": "http://example.com/data.json",
"requestId": "REQUEST-1"
}
},
"request": "http://example.com/data.json"
}
]
}
`;
exports[`IssueFormatter > formats a detailed issue with an unresolved request id toStringDetailed 1`] = `
ID: 7
Message: issue> Mock Issue Title
This is a mock issue description
### Affected resources
url=http://example.com/data.json data={"request":{"url":"http://example.com/data.json","requestId":"REQUEST-1"}}
`;
exports[`IssueFormatter > formats a simplified issue toJSON 1`] = `
{
"type": "issue",
"title": "Issue Title",
"count": 5,
"id": 1
}
`;
exports[`IssueFormatter > formats a simplified issue toString 1`] = `
msgid=1 [issue] Issue Title (count: 5)
`;
exports[`IssueFormatter > formats an issue message toJSON 1`] = `
{
"type": "issue",
"title": "Mock Issue Title",
"id": 5
}
`;
exports[`IssueFormatter > formats an issue message toString 1`] = `
msgid=5 [issue] Mock Issue Title (count: undefined)
`;