When working on a test, I might run, and rerun it 100 times while stepping through in debug mode, refactoring and re-checking certain things, but vitest's default timeout period is only 5s, and vitest's extension doesn't have any option (that I can seee) which lets you set the vitest's test-timeout/testTimeout value - or disregard it when VSCODE_INSPECTOR_OPTIONS is set in the environment variables.
My preferred ways to debug a test is to right-click it, and "Debug test",

And I'm using vitest's official vscode extension - https://marketplace.visualstudio.com/items?itemName=vitest.explorer
There's a few options I've found that work, the first is to basically redo their test in a helper.js file like,
import { TestOptions, test as _test } from "vitest";
export function test(name: string, fn: any): void {
const options: TestOptions = {};
if (process.env.VSCODE_INSPECTOR_OPTIONS) {
options.timeout = 999999;
}
return _test(name, options, fn);
}
I don't like this because it's a messy unnecessary function where I import test from helper instead of from vitest.
The other is in the runner class, where I set the timeout in the config like,
import { describe, expect, it } from "vitest";
import { rebuildLeaderboardScores } from "../lib/leaderboard";
const options = {
timeout: process.env.VSCODE_INSPECTOR_OPTIONS ? 999999 : 5000,
};
describe("leaderboard functions test set", options, () => {
it("rebuilding leaderboard attempt that doesn't exist fails", () => {
expect(() => rebuildLeaderboardScores("1")).toThrowError(/leaderboard/);
});
});
Again, this one works fine, but I either have to have that option in every test file, or again in a helper file and import it in, which I just consider messy and would prefer to do without.
The last, probably most preferable way I've found is to extend your default vitest.config and set test.testTimeout there like,
import config from "./vitest.config";
config.test!.testTimeout = 999999;
export default config;
And then, in the plugin's config, refer to this file, instead of your standard config file. This is the most preferable option I think, but I still feel like there's another option, or setting I'm missing that's better. It still isn't actually disabling the timeout, and it still adds a tiny bit of overhead in terms of the extra file, in terms of maintenance.
I know there are some ways to set the test-timeout via the CLI, but even that doesn't seem to work right when you debug the way that I do.
The issue with both of those is that that that timeout variable will be there for every test run in vscode, not just ones that are being debugged / not when VSCODE_INSPECTOR_OPTIONS is ste.


