microsoft / microsoft/vscode-js-debug
I am unable to execute tests with the Playwright test runner in debug mode
@connor4312 is already working on this.
Since Nov 29, 2024.
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 373
- Avg merge
- 1d 9m
- Merged PRs (30d)
- 6
Description
I am unable to execute tests with the Playwright test runner in debug mode under the following conditions:
Debugging with Breakpoints:
When I run tests in debug mode and set a breakpoint, the execution does not start and becomes unresponsive.
(Refer to the attached image for reference: "See Image").
Frozen Execution:
The test execution remains frozen, as shown in the image.
(Refer to the attached image for reference: "See Image").
Console Error Message:
If I stop the execution manually, I see the following message in the console:
arduino
Copiar código
Process exited with code 1
Despite the error message, the execution timer continues to run, and the only way to fully terminate the process is by closing VSCode entirely.
(Refer to the attached image for reference: "See Image").
Workaround with Debugging:
The only way I have managed to debug tests is by:
Starting the debug execution without breakpoints.
Adding the breakpoint after the browser instance has launched.
(Refer to the attached image for reference: "See Image").
Configuration Details
Below is my tsconfig.json configuration:
{
"compilerOptions": {
"target": "es2016",
"module": "commonjs",
"sourceMap": true,
"outDir": "./dist",
"resolveJsonModule": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": false,
"noImplicitAny": false,
"skipLibCheck": true
},
"include": ["tests//*.ts", "pages//*.ts", "run-tests-by-tags.js"],
"exclude": ["node_modules"]
}
And here is my launch.json configuration:
{
"name": "Debug Playwright Tests with ts-node",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/ts-node/dist/bin.js",
"args": ["${workspaceFolder}/tests/Administracion.spec.ts"],
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**"]
}
Bug Report for VSCode
Issue Description
I am unable to execute tests with the Playwright test runner in debug mode under the following conditions:
Debugging with Breakpoints:
When I run tests in debug mode and set a breakpoint, the execution does not start and becomes unresponsive.
(Refer to the attached image for reference: "See Image").
Frozen Execution:
The test execution remains frozen, as shown in the image.
(Refer to the attached image for reference: "See Image").
Console Error Message:
If I stop the execution manually, I see the following message in the console:
arduino
Process exited with code 1
Despite the error message, the execution timer continues to run, and the only way to fully terminate the process is by closing VSCode entirely.
(Refer to the attached image for reference: "See Image").
Workaround with Debugging:
The only way I have managed to debug tests is by:
Starting the debug execution without breakpoints.
Adding the breakpoint after the browser instance has launched.
(Refer to the attached image for reference: "See Image").
Configuration Details
Below is my tsconfig.json configuration:
json
{
"compilerOptions": {
"target": "es2016",
"module": "commonjs",
"sourceMap": true,
"outDir": "./dist",
"resolveJsonModule": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": false,
"noImplicitAny": false,
"skipLibCheck": true
},
"include": ["tests//*.ts", "pages//*.ts", "run-tests-by-tags.js"],
"exclude": ["node_modules"]
}
And here is my launch.json configuration:
json
{
"name": "Debug Playwright Tests with ts-node",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/ts-node/dist/bin.js",
"args": ["${workspaceFolder}/tests/Administracion.spec.ts"],
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**"]
}
Expected Behavior
- The test execution should begin and pause at the specified breakpoints in debug mode without freezing.
- Upon stopping the test execution, all processes should terminate properly, and the console should stop logging execution time.
Actual Behavior - Tests freeze when starting execution with breakpoints.
- Manual stopping of execution leaves the timer running indefinitely.
- Proper debug functionality is only achieved through a workaround (starting execution first, then adding breakpoints).
Steps to Reproduce
- Configure VSCode with the provided tsconfig.json and launch.json.
- Start a test in debug mode with a breakpoint set before the execution.
- Observe that the test execution does not start and remains frozen.
- Attempt to manually stop the process and note the error message and timer behavior.
Additional Notes
- This issue significantly disrupts the workflow for debugging Playwright tests.
- The workaround is functional but cumbersome and time-consuming.
- Attached images provide visual references for the issue and the configurations. (See Images)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.