@@ -17,3 +17,89 @@ index 0663c5c..4991663 100644
1717 const options = JSON.parse(PARENT_JEST_OPTIONS);
1818 const jestOptions = [
1919 ...options.args,
20+ diff --git a/node_modules/jest-runner-vscode/dist/public-types.d.ts b/node_modules/jest-runner-vscode/dist/public-types.d.ts
21+ index 57716e5..d8614af 100644
22+ --- a/node_modules/jest-runner-vscode/dist/public-types.d.ts
23+ +++ b/node_modules/jest-runner-vscode/dist/public-types.d.ts
24+ @@ -59,4 +59,5 @@ export interface RunnerOptions {
25+ * code, or download progress. Defaults to `false`.
26+ */
27+ quiet?: boolean;
28+ + retries?: number;
29+ }
30+ diff --git a/node_modules/jest-runner-vscode/dist/run-vscode.d.ts b/node_modules/jest-runner-vscode/dist/run-vscode.d.ts
31+ index 8657ace..4d35409 100644
32+ --- a/node_modules/jest-runner-vscode/dist/run-vscode.d.ts
33+ +++ b/node_modules/jest-runner-vscode/dist/run-vscode.d.ts
34+ @@ -16,5 +16,7 @@ export declare type RunVSCodeOptions = {
35+ onFailure: JestRunner.OnTestFailure;
36+ ipc: InstanceType<typeof IPC>;
37+ quiet?: boolean;
38+ + attempt?: number;
39+ + maxRetries?: number;
40+ };
41+ - export default function runVSCode({ vscodePath, args, jestArgs, env, tests, globalConfig, filterOutput, onStart, onResult, onFailure, ipc, quiet, }: RunVSCodeOptions): Promise<void>;
42+ + export default function runVSCode(options: RunVSCodeOptions): Promise<void>;
43+ diff --git a/node_modules/jest-runner-vscode/dist/run-vscode.js b/node_modules/jest-runner-vscode/dist/run-vscode.js
44+ index 5d8e513..6edf99a 100644
45+ --- a/node_modules/jest-runner-vscode/dist/run-vscode.js
46+ +++ b/node_modules/jest-runner-vscode/dist/run-vscode.js
47+ @@ -5,7 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
48+ Object.defineProperty(exports, "__esModule", { value: true });
49+ const child_process_1 = __importDefault(require("child_process"));
50+ const console_1 = __importDefault(require("console"));
51+ - async function runVSCode({ vscodePath, args, jestArgs, env, tests, globalConfig, filterOutput, onStart, onResult, onFailure, ipc, quiet, }) {
52+ + async function runVSCode(options) {
53+ + const { vscodePath, args, jestArgs, env, tests, globalConfig, filterOutput, onStart, onResult, onFailure, ipc, quiet, attempt, maxRetries, } = options;
54+ return await new Promise(resolve => {
55+ const useStdErr = globalConfig.json || globalConfig.useStderr;
56+ const log = useStdErr
57+ @@ -101,11 +102,31 @@ async function runVSCode({ vscodePath, args, jestArgs, env, tests, globalConfig,
58+ const message = `VS Code exited with exit code ${exit}`;
59+ if (typeof code !== 'number' || code !== 0) {
60+ silent || quiet || console_1.default.error(message);
61+ - const error = vscodeError ?? childError ?? new Error(message);
62+ - for (const test of tests) {
63+ - const completed = completedTests.has(test);
64+ - if (!completed) {
65+ - await onFailure(test, error);
66+ + const currentAttempt = attempt ?? 0;
67+ + if (maxRetries && maxRetries > 0 && currentAttempt < maxRetries) {
68+ + const newAttempt = currentAttempt + 1;
69+ + const newTests = tests.filter(test => !completedTests.has(test));
70+ + ipc.server.off('testFileResult', onTestFileResult);
71+ + ipc.server.off('testStart', onTestStart);
72+ + ipc.server.off('testFileStart', onTestStart);
73+ + ipc.server.off('stdout', onStdout);
74+ + ipc.server.off('stderr', onStderr);
75+ + ipc.server.off('error', onError);
76+ + await runVSCode({
77+ + ...options,
78+ + tests: newTests,
79+ + attempt: newAttempt,
80+ + });
81+ + resolve();
82+ + return;
83+ + }
84+ + else {
85+ + const error = vscodeError ?? childError ?? new Error(message);
86+ + for (const test of tests) {
87+ + const completed = completedTests.has(test);
88+ + if (!completed) {
89+ + await onFailure(test, error);
90+ + }
91+ }
92+ }
93+ }
94+ diff --git a/node_modules/jest-runner-vscode/dist/runner.js b/node_modules/jest-runner-vscode/dist/runner.js
95+ index e24c976..c374022 100644
96+ --- a/node_modules/jest-runner-vscode/dist/runner.js
97+ +++ b/node_modules/jest-runner-vscode/dist/runner.js
98+ @@ -107,6 +107,7 @@ class VSCodeTestRunner {
99+ onFailure,
100+ ipc,
101+ quiet: vscodeOptions.quiet,
102+ + maxRetries: vscodeOptions.retries,
103+ });
104+ }
105+ catch (error) {
0 commit comments