diff --git a/.eslintignore b/.eslintignore index 6583d3bd50af5..1700c34b9fd39 100644 --- a/.eslintignore +++ b/.eslintignore @@ -22,6 +22,8 @@ generated/ # IDE Artifacts .vscode +!.vscode/extensions.json +!.vscode/*.template.json .devcontainer # Misc diff --git a/.gitignore b/.gitignore index 04c4e0e162b46..83af90e063bb1 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ generated/ # IDE Artifacts .vscode/* !.vscode/extensions.json +!.vscode/*.template.json .devcontainer # Misc diff --git a/.prettierignore b/.prettierignore index 90dbef6a62e40..8e32b9405673d 100644 --- a/.prettierignore +++ b/.prettierignore @@ -23,6 +23,7 @@ generated/ # IDE Artifacts .vscode/* !.vscode/extensions.json +!.vscode/*.template.json .devcontainer # Misc diff --git a/.vscode/launch.template.json b/.vscode/launch.template.json new file mode 100644 index 0000000000000..cdd05181beb30 --- /dev/null +++ b/.vscode/launch.template.json @@ -0,0 +1,43 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "inputs": [ + { + "type": "pickString", + "id": "suit", + "description": "Which test suit to run?", + "options": [ + "chrome-headless", + "chrome-headful", + "chrome-new-headless", + "firefox-headless", + "firefox-headful", + "firefox-bidi", + "chrome-bidi" + ], + "default": "chrome-headless" + } + ], + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Launch Tests", + "skipFiles": ["/**"], + "runtimeExecutable": "npm", + "cwd": "${workspaceFolder}", + "runtimeArgs": [ + "run-script", + "test", + "--", + "--test-suite", + "${input:suit}", + "--no-coverage", + "--no-suggestions" + ], + "outFiles": ["${workspaceFolder}/**/*.js"] + } + ] +} diff --git a/docs/contributing.md b/docs/contributing.md index c267e6a56fd55..deff56718220b 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -264,6 +264,16 @@ ensure this, the main `test` command runs coverage during testing. See [Debugging Tips](https://pptr.dev/guides/debugging). +### Debugging Puppeteer tests via VSCode + +Copy the provided default `.vscode/launch.template.json` to `.vscode/launch.json` and then use the integrated VSCode debugger to debug test. + +Remember to build test before launching via: + +```sh +npm run build --workspace @puppeteer-test/test +``` + # For Project Maintainers ## Rolling new Chromium version