Skip to content

Commit

Permalink
Debug tests in trace mode to disable timeouts
Browse files Browse the repository at this point in the history
Fixes #411
  • Loading branch information
lukaszsamson committed May 5, 2024
1 parent 6e46e83 commit 8e68094
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#### Improvements

- ElixirLS updated to [v0.21.0](https://github.com/elixir-lsp/elixir-ls/blob/master/CHANGELOG.md#v0210)
- Debug test from Test UI now runs tests in trace mode to disable timeouts
- New logo [Kirills Reunovs](https://github.com/Kirlovon)

### v0.20.0: 21 February 2024
Expand Down
11 changes: 7 additions & 4 deletions src/commands/runTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function getExistingLaunchConfig(
...(testConfig.env ?? {}),
};
// as of vscode 1.78 ANSI is not fully supported
testConfig.taskArgs = buildTestCommandArgs(args);
testConfig.taskArgs = buildTestCommandArgs(args, debug);
testConfig.requireFiles = [
"test/**/test_helper.exs",
"apps/*/test/**/test_helper.exs",
Expand All @@ -75,7 +75,7 @@ function getLaunchConfig(
env: {
MIX_ENV: "test",
},
taskArgs: buildTestCommandArgs(args),
taskArgs: buildTestCommandArgs(args, debug),
startApps: true,
projectDir: args.cwd,
// we need to require all test helpers and only the file we need to test
Expand Down Expand Up @@ -230,7 +230,7 @@ const COMMON_ARGS = [
"ElixirLS.DebugAdapter.ExUnitFormatter",
];

function buildTestCommandArgs(args: RunTestArgs): string[] {
function buildTestCommandArgs(args: RunTestArgs, debug: boolean): string[] {
let line = "";
if (typeof args.line === "number") {
line = `:${args.line}`;
Expand Down Expand Up @@ -260,5 +260,8 @@ function buildTestCommandArgs(args: RunTestArgs): string[] {
result.push(`${path}${line}`);
}

return [...result, ...COMMON_ARGS];
// debug tests in tracing mode to disable timeouts
const maybeTrace = debug ? ["--trace"] : [];

return [...maybeTrace, ...result, ...COMMON_ARGS];
}

0 comments on commit 8e68094

Please sign in to comment.