From 25154c14d7ae93a944db141eab87dc21bbb03824 Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com> Date: Thu, 2 Feb 2023 09:01:57 +0100 Subject: [PATCH] chore: Add launch.template.json for debugging tests (#9599) --- .eslintignore | 2 ++ .gitignore | 1 + .prettierignore | 1 + .vscode/launch.template.json | 43 ++++++++++++++++++++++++++++++++++++ docs/contributing.md | 10 +++++++++ 5 files changed, 57 insertions(+) create mode 100644 .vscode/launch.template.json diff --git a/.eslintignore b/.eslintignore index 6583d3bd..1700c34b 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 04c4e0e1..83af90e0 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 90dbef6a..8e32b940 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 00000000..cdd05181 --- /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 c267e6a5..deff5671 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