@@ -41,7 +41,7 @@ index 8657ace..4d35409 100644
4141- export default function runVSCode({ vscodePath, args, jestArgs, env, tests, globalConfig, filterOutput, onStart, onResult, onFailure, ipc, quiet, }: RunVSCodeOptions): Promise<void>;
4242+ export default function runVSCode(options: RunVSCodeOptions): Promise<void>;
4343diff --git a/node_modules/jest-runner-vscode/dist/run-vscode.js b/node_modules/jest-runner-vscode/dist/run-vscode.js
44- index 5d8e513..cacbc42 100644
44+ index 5d8e513..7e556ee 100644
4545--- a/node_modules/jest-runner-vscode/dist/run-vscode.js
4646+++ b/node_modules/jest-runner-vscode/dist/run-vscode.js
4747@@ -5,8 +5,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
@@ -78,44 +78,37 @@ index 5d8e513..cacbc42 100644
7878 if (!silent && !filterOutput) {
7979 vscode.stdout.pipe(process.stdout);
8080 vscode.stderr.pipe(process.stderr);
81- @@ -101,11 +115,31 @@ async function runVSCode({ vscodePath, args, jestArgs, env, tests, globalConfig,
81+ @@ -99,6 +113,29 @@ async function runVSCode({ vscodePath, args, jestArgs, env, tests, globalConfig,
82+ exited = true;
83+ const exit = code ?? signal ?? '<unknown>';
8284 const message = `VS Code exited with exit code ${exit}`;
85+ + const currentAttempt = attempt ?? 0;
86+ + const incompleteTests = tests.some(test => !completedTests.has(test));
87+ + if (maxRetries &&
88+ + maxRetries > 0 &&
89+ + currentAttempt < maxRetries &&
90+ + incompleteTests) {
91+ + silent || quiet || log(message);
92+ + const newAttempt = currentAttempt + 1;
93+ + const newTests = tests.filter(test => !completedTests.has(test));
94+ + ipc.server.off('testFileResult', onTestFileResult);
95+ + ipc.server.off('testStart', onTestStart);
96+ + ipc.server.off('testFileStart', onTestStart);
97+ + ipc.server.off('stdout', onStdout);
98+ + ipc.server.off('stderr', onStderr);
99+ + ipc.server.off('error', onError);
100+ + await runVSCode({
101+ + ...options,
102+ + tests: newTests,
103+ + attempt: newAttempt,
104+ + });
105+ + resolve();
106+ + return;
107+ + }
83108 if (typeof code !== 'number' || code !== 0) {
84109 silent || quiet || console_1.default.error(message);
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- + const currentAttempt = attempt ?? 0;
91- + if (maxRetries && maxRetries > 0 && currentAttempt < maxRetries) {
92- + const newAttempt = currentAttempt + 1;
93- + const newTests = tests.filter(test => !completedTests.has(test));
94- + ipc.server.off('testFileResult', onTestFileResult);
95- + ipc.server.off('testStart', onTestStart);
96- + ipc.server.off('testFileStart', onTestStart);
97- + ipc.server.off('stdout', onStdout);
98- + ipc.server.off('stderr', onStderr);
99- + ipc.server.off('error', onError);
100- + await runVSCode({
101- + ...options,
102- + tests: newTests,
103- + attempt: newAttempt,
104- + });
105- + resolve();
106- + return;
107- + }
108- + else {
109- + const error = vscodeError ?? childError ?? new Error(message);
110- + for (const test of tests) {
111- + const completed = completedTests.has(test);
112- + if (!completed) {
113- + await onFailure(test, error);
114- + }
115- }
116- }
117- }
118- @@ -138,3 +172,6 @@ async function runVSCode({ vscodePath, args, jestArgs, env, tests, globalConfig,
110+ const error = vscodeError ?? childError ?? new Error(message);
111+ @@ -138,3 +175,6 @@ async function runVSCode({ vscodePath, args, jestArgs, env, tests, globalConfig,
119112 });
120113 }
121114 exports.default = runVSCode;
0 commit comments