Skip to content

Commit 82f5256

Browse files
committed
Do cleanup in rigTestNode
1 parent 638c0fb commit 82f5256

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/test/util/rig-test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,20 @@ export function rigTestNode(
103103
handler: (args: {rig: WireitTestRig}) => unknown,
104104
options?: {flaky?: boolean},
105105
): TestFn {
106+
const runTest = async () => {
107+
await using rig = await WireitTestRig.setup();
108+
await handler({rig});
109+
};
106110
if (options?.flaky) {
107111
return async () => {
108112
try {
109-
await handler({rig: await WireitTestRig.setup()});
110-
return;
113+
return await runTest();
111114
} catch {
112115
console.log('Test failed, retrying...');
113116
}
114-
await handler({rig: await WireitTestRig.setup()});
117+
return await runTest();
115118
};
116119
} else {
117-
return async () => {
118-
await handler({rig: await WireitTestRig.setup()});
119-
};
120+
return runTest;
120121
}
121122
}

0 commit comments

Comments
 (0)