Skip to content

Commit c9951c4

Browse files
committed
skip
1 parent a959794 commit c9951c4

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

ts/packages/cli/src/commands/test/translate.ts

+14-7
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ type TestResult = {
2626
type FailedTestResult = {
2727
request: string;
2828
actions?: (FullAction[] | undefined)[];
29-
reason?: string;
3029
};
3130

3231
type TestResultFile = {
3332
pass: TestResult[];
3433
fail: FailedTestResult[];
34+
skipped?: string[];
3535
};
3636

3737
function summarizeResult(result: TestResultFile) {
@@ -178,6 +178,9 @@ export default class TestTranslateCommand extends Command {
178178
}
179179

180180
requests = input.fail.map((entry) => entry.request);
181+
if (input.skipped) {
182+
requests = requests.concat(input.skipped);
183+
}
181184
if (flags.failed) {
182185
output.pass = input.pass;
183186
} else {
@@ -214,14 +217,14 @@ export default class TestTranslateCommand extends Command {
214217

215218
let countStr = requests.length.toString();
216219
if (flags.sample !== undefined) {
220+
output.skipped = [];
217221
while (flags.sample < requests.length) {
218-
output.fail.push({
219-
request: requests.splice(
222+
output.skipped.push(
223+
...requests.splice(
220224
Math.floor(Math.random() * requests.length),
221225
1,
222-
)[0],
223-
reason: "skipped",
224-
});
226+
),
227+
);
225228
}
226229
countStr = `${flags.sample}/${countStr}`;
227230
}
@@ -348,7 +351,10 @@ export default class TestTranslateCommand extends Command {
348351
const endTime = performance.now();
349352
const succeededTotal = processed - noActions - failedTotal;
350353

351-
const totalData = output.pass.length + output.fail.length;
354+
const totalData =
355+
output.pass.length +
356+
output.fail.length +
357+
(output.skipped?.length ?? 0);
352358
const totalDataStr = totalData.toString();
353359
const numberLength = totalDataStr.length;
354360
function printPart(name: string, count: number, total: number) {
@@ -374,6 +380,7 @@ export default class TestTranslateCommand extends Command {
374380
console.log(`Total : ${totalDataStr.padStart(numberLength)}`);
375381
printPart("Passed", output.pass.length, totalData);
376382
printPart("Failed", output.fail.length, totalData);
383+
printPart("Skipped", output.skipped?.length ?? 0, totalData);
377384
console.log("=".repeat(60));
378385
console.log(
379386
`Time: ${getElapsedString(endTime - startTime)}, Average: ${getElapsedString((endTime - startTime) / processed)}`,

0 commit comments

Comments
 (0)