@@ -26,12 +26,12 @@ type TestResult = {
26
26
type FailedTestResult = {
27
27
request : string ;
28
28
actions ?: ( FullAction [ ] | undefined ) [ ] ;
29
- reason ?: string ;
30
29
} ;
31
30
32
31
type TestResultFile = {
33
32
pass : TestResult [ ] ;
34
33
fail : FailedTestResult [ ] ;
34
+ skipped ?: string [ ] ;
35
35
} ;
36
36
37
37
function summarizeResult ( result : TestResultFile ) {
@@ -178,6 +178,9 @@ export default class TestTranslateCommand extends Command {
178
178
}
179
179
180
180
requests = input . fail . map ( ( entry ) => entry . request ) ;
181
+ if ( input . skipped ) {
182
+ requests = requests . concat ( input . skipped ) ;
183
+ }
181
184
if ( flags . failed ) {
182
185
output . pass = input . pass ;
183
186
} else {
@@ -214,14 +217,14 @@ export default class TestTranslateCommand extends Command {
214
217
215
218
let countStr = requests . length . toString ( ) ;
216
219
if ( flags . sample !== undefined ) {
220
+ output . skipped = [ ] ;
217
221
while ( flags . sample < requests . length ) {
218
- output . fail . push ( {
219
- request : requests . splice (
222
+ output . skipped . push (
223
+ ... requests . splice (
220
224
Math . floor ( Math . random ( ) * requests . length ) ,
221
225
1 ,
222
- ) [ 0 ] ,
223
- reason : "skipped" ,
224
- } ) ;
226
+ ) ,
227
+ ) ;
225
228
}
226
229
countStr = `${ flags . sample } /${ countStr } ` ;
227
230
}
@@ -348,7 +351,10 @@ export default class TestTranslateCommand extends Command {
348
351
const endTime = performance . now ( ) ;
349
352
const succeededTotal = processed - noActions - failedTotal ;
350
353
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 ) ;
352
358
const totalDataStr = totalData . toString ( ) ;
353
359
const numberLength = totalDataStr . length ;
354
360
function printPart ( name : string , count : number , total : number ) {
@@ -374,6 +380,7 @@ export default class TestTranslateCommand extends Command {
374
380
console . log ( `Total : ${ totalDataStr . padStart ( numberLength ) } ` ) ;
375
381
printPart ( "Passed" , output . pass . length , totalData ) ;
376
382
printPart ( "Failed" , output . fail . length , totalData ) ;
383
+ printPart ( "Skipped" , output . skipped ?. length ?? 0 , totalData ) ;
377
384
console . log ( "=" . repeat ( 60 ) ) ;
378
385
console . log (
379
386
`Time: ${ getElapsedString ( endTime - startTime ) } , Average: ${ getElapsedString ( ( endTime - startTime ) / processed ) } ` ,
0 commit comments