12
12
//
13
13
//===----------------------------------------------------------------------===//
14
14
15
+ import * as assert from "assert" ;
15
16
import * as vscode from "vscode" ;
16
17
import { beforeEach , afterEach } from "mocha" ;
17
18
import { testAssetUri } from "../../fixtures" ;
@@ -35,6 +36,11 @@ import {
35
36
TestSymbol ,
36
37
} from "../../../src/TestExplorer/TestParsers/SwiftTestingOutputParser" ;
37
38
import { mockGlobalObject } from "../../MockUtils" ;
39
+ import {
40
+ flattenTestItemCollection ,
41
+ reduceTestItemChildren ,
42
+ } from "../../../src/TestExplorer/TestUtils" ;
43
+ import { runnableTag } from "../../../src/TestExplorer/TestDiscovery" ;
38
44
39
45
suite ( "Test Explorer Suite" , function ( ) {
40
46
const MAX_TEST_RUN_TIME_MINUTES = 5 ;
@@ -513,16 +519,13 @@ suite("Test Explorer Suite", function () {
513
519
} ) ;
514
520
515
521
test ( `Runs parameterized test (${ runProfile } )` , async function ( ) {
516
- const testRun = await runTest (
517
- testExplorer ,
518
- runProfile ,
519
- "PackageTests.parameterizedTest(_:)"
520
- ) ;
522
+ const testId = "PackageTests.parameterizedTest(_:)" ;
523
+ const testRun = await runTest ( testExplorer , runProfile , testId ) ;
521
524
522
525
assertTestResults ( testRun , {
523
526
passed : [
524
- "PackageTests.parameterizedTest(_:) /PackageTests.swift:59:2/argumentIDs: Optional([Testing.Test.Case.Argument.ID(bytes: [49])])" ,
525
- "PackageTests.parameterizedTest(_:) /PackageTests.swift:59:2/argumentIDs: Optional([Testing.Test.Case.Argument.ID(bytes: [51])])" ,
527
+ ` ${ testId } /PackageTests.swift:59:2/argumentIDs: Optional([Testing.Test.Case.Argument.ID(bytes: [49])])` ,
528
+ ` ${ testId } /PackageTests.swift:59:2/argumentIDs: Optional([Testing.Test.Case.Argument.ID(bytes: [51])])` ,
526
529
] ,
527
530
failed : [
528
531
{
@@ -532,14 +535,37 @@ suite("Test Explorer Suite", function () {
532
535
text : "Expectation failed: (arg → 2) != 2" ,
533
536
} ) } `,
534
537
] ,
535
- test : "PackageTests.parameterizedTest(_:) /PackageTests.swift:59:2/argumentIDs: Optional([Testing.Test.Case.Argument.ID(bytes: [50])])" ,
538
+ test : ` ${ testId } /PackageTests.swift:59:2/argumentIDs: Optional([Testing.Test.Case.Argument.ID(bytes: [50])])` ,
536
539
} ,
537
540
{
538
541
issues : [ ] ,
539
- test : "PackageTests.parameterizedTest(_:)" ,
542
+ test : testId ,
540
543
} ,
541
544
] ,
542
545
} ) ;
546
+
547
+ // Verifiy that the children of the parameterized test are not runnable
548
+ const parameterizedTestItem = flattenTestItemCollection (
549
+ testExplorer . controller . items
550
+ ) . find ( item => item . id === testId ) ;
551
+
552
+ assert . ok (
553
+ parameterizedTestItem ,
554
+ `Unable to find ${ testId } in test explorer children`
555
+ ) ;
556
+
557
+ const unrunnableChildren = reduceTestItemChildren (
558
+ parameterizedTestItem ?. children ?? [ ] ,
559
+ ( acc , item ) => {
560
+ return [
561
+ ...acc ,
562
+ item . tags . find ( tag => tag . id === runnableTag . id ) === undefined ,
563
+ ] ;
564
+ } ,
565
+ [ ] as boolean [ ]
566
+ ) ;
567
+
568
+ assert . deepEqual ( unrunnableChildren , [ true , true , true ] ) ;
543
569
} ) ;
544
570
545
571
test ( `Runs Suite (${ runProfile } )` , async function ( ) {
0 commit comments