From 2754900069c34e427c19a0099ae96b68682f9efa Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Fri, 5 Nov 2021 16:14:32 +0000 Subject: [PATCH] dawn_node: Add documentation on how you debug TS Change-Id: Iadaec50162da6f958016ec22f69623ab58ff461b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66922 Reviewed-by: Antonio Maiorano Commit-Queue: Ben Clayton --- src/dawn_node/README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/dawn_node/README.md b/src/dawn_node/README.md index 5d13626899..2faf96c68b 100644 --- a/src/dawn_node/README.md +++ b/src/dawn_node/README.md @@ -72,6 +72,40 @@ For example, on Windows, to use the d3dcompiler_47.dll from a Chromium checkout, ``` Note that we pass `--verbose` above so that all test output, including the dumped shader, is written to stdout. + +## Debugging TypeScript with VSCode + +Open or create the `.vscode/launch.json` file, and add: + +```json +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug with node", + "type": "node", + "request": "launch", + "outFiles": [ "./**/*.js" ], + "args": [ + "-e", "require('./src/common/tools/setup-ts-in-node.js');require('./src/common/runtime/cmdline.ts');", + "--", "dummy-arg", + "--gpu-provider", + "[path-to-dawn.node]", // REPLACE: [path-to-dawn.node] + "[test-query]", // REPLACE: [test-query] + ], + "cwd": "[cts-root]" // REPLACE: [cts-root] + } + ] +} +``` + +Replacing: + +- `[cts-root]` with the path to the CTS root directory. If you are editing the `.vscode/launch.json` from within the CTS workspace, then you may use `${workspaceFolder}`. +- `[path-to-dawn.node]` this the path to the `dawn.node` module built by the [build step](#Build) +- `test-query` with the test query string. Example: `webgpu:shader,execution,builtin,abs:*` + + ## Known issues - Many WebGPU CTS tests are currently known to fail