Skip to content

Commit

Permalink
Add support for debugging Prism tests in VSCode
Browse files Browse the repository at this point in the history
  • Loading branch information
st0012 committed Oct 29, 2024
1 parent 983b380 commit bab4eb4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
22 changes: 21 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,26 @@
"ignoreFailures": false
}
]
},
{
"type": "lldb",
"request": "launch",
"name": "Debug Prism test in LLDB",
"program": "${workspaceFolder}/bazel-bin/test/test_PosTests/prism_regression/${input:test_name}.runfiles/com_stripe_ruby_typer/test/pipeline_test_runner",
"args": ["--single_test=${workspaceFolder}/test/prism_regression/${input:test_name}.rb", "--parser=prism"],
// See .vscode/tasks.json for the task that sets the `BAZEL_EXEC_ROOT` environment variable.
"preLaunchTask": "Prepare tests debugging",
"stopOnEntry": false,
"sourceMap": {
"${env:BAZEL_EXEC_ROOT}": "${workspaceFolder}",
},
},
],
"inputs": [
{
"id": "test_name",
"type": "promptString",
"description": "Enter the test name, e.g. case for running test/prism_regression/case.rb",
}
]
}
}
17 changes: 17 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,23 @@
"reveal": "always"
}
},
// This task:
// - Runs tests to generate the pipeline_test_runner files, which are needed by the LLDB
// debugger to execute the tests.
// - Sets the `BAZEL_EXEC_ROOT` environment variable, which is used by the LLDB
// debugger to find the source files.
{
"label": "Prepare tests debugging",
"type": "shell",
"command": "export BAZEL_EXEC_ROOT=$(./bazel info execution_root)",
// We need to run tests first to get the pipeline_test_runner files generated
// Just building Sorbet with Prism doesn't generate them.
"dependsOn": ["Run all Prism tests"],
"hide": true,
"presentation": {
"reveal": "never",
}
}
],
"inputs": [
{
Expand Down

0 comments on commit bab4eb4

Please sign in to comment.