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
Scenario: Playwright config command produces warnings as part of output
GIVEN the following command produces output that is not just JSON.
playwright test --list --reporter=json
Warning: Cannot polyfill `DOMMatrix`, rendering may be broken.Warning: Cannot polyfill `Path2D`, rendering may be broken.
{
"config": {
...many more lines
}
}
WHEN discovery is performed
THEN no tests are found.
Logs
WARN | 2025-01-23T22:51:17Z-0600 | ...al/nvim-data/lazy/neotest/lua/neotest/lib/subprocess.lua:164 | CHILD | Error in remote call Vim:E474: Unidentified byte: Warning: Cannot polyfill `DOMMatrix`, rendering may be broken.
Warning: Cannot polyfill `Path2D`, rendering may be broken.
{
"config": {
"configFile": "C:\\Users\\sfree\\software_projects\\OnspringEnd2EndTests\\playwright.config.ts",
"rootDir": "C:/Users/sfree/software_projects/OnspringEnd2EndTests/tests",
"forbidOnly": false,
"fullyParallel": true,
"globalSetup": null,
"globalTeardown": null,
"globalTimeout": 0,
"grep": {},
"grepInvert": null,
"maxFailures": 0,
"metadata": {
"environment": "QA"
},
"preserveOutput": "always",
"reporter": [
[
"json"
]
],
"reportSlowTests": null,
"quiet": false,
"projects": [
{
"outputDir": "C:/Users/sfree/software_projects/OnspringEnd2EndTests/test-results",
"repeatEach": 1,
"retries": 0,
"metadata": {
"environment": "QA"
},
"id": "setup",
"name": "setup",
"testDir": "C:/User
stack traceback:
[C]: in function 'json_decode'
...neotest-playwright/lua/neotest-playwright/playwright.lua:225: in function 'run'
...neotest-playwright/lua/neotest-playwright/playwright.lua:196: in function 'get_config'
...y/neotest-playwright/lua/neotest-playwright/discover.lua:254: in function 'refresh_data'
...y/neotest-playwright/lua/neotest-playwright/discover.lua:248: in function 'func'
...al/nvim-data/lazy/neotest/lua/neotest/lib/subprocess.lua:156: in function <...al/nvim-data/lazy/neotest/lua/neotest/lib/subprocess.lua:155>
[C]: in function 'xpcall'
...al/nvim-data/lazy/neotest/lua/neotest/lib/subprocess.lua:155: in function <...al/nvim-data/lazy/neotest/lua/neotest/lib/subprocess.lua:154>
Proposed Solution
Obviously a fix can be achieved for this by addressing the warnings or additional output being produced I believe my just making sure to parse the beginning and ending of the JSON here we can handle this more gracefully
I'm thinking something like this will do the trick:
constjsonMatch=string.match(output,"%b{}");if(!jsonMatch){emitError(`Failed to parse JSON output: ${output}`);return;}constjsonString=jsonMatch[0];try{constdecoded=vim.fn.json_decode(jsonString)asP.JSONReport;returndecoded;}catch(err){if(errinstanceofError){emitError(`Failed to decode JSON: ${err.message}`);}return;}
The text was updated successfully, but these errors were encountered:
Problem
Scenario: Playwright config command produces warnings as part of output
GIVEN the following command produces output that is not just JSON.
playwright test --list --reporter=json
WHEN discovery is performed
THEN no tests are found.
Logs
Proposed Solution
Obviously a fix can be achieved for this by addressing the warnings or additional output being produced I believe my just making sure to parse the beginning and ending of the JSON here we can handle this more gracefully
neotest-playwright/src/playwright.ts
Lines 34 to 62 in 6266945
I'm thinking something like this will do the trick:
The text was updated successfully, but these errors were encountered: