@@ -16,12 +16,11 @@ readdirSync(join(__dirname, '../src/material'), {withFileTypes: true})
16
16
. filter ( name => ! config . skippedPackages . includes ( `mdc-${ name } ` ) )
17
17
. filter ( hasCorrespondingMdcPackage )
18
18
. forEach ( name => {
19
- const missingSymbols = getMissingSymbols ( name , config . skippedExports [ `mdc- ${ name } ` ] || [ ] ) ;
19
+ checkPackage ( name ) ;
20
20
21
- if ( missingSymbols . length ) {
22
- console . log ( chalk . redBright ( `\nMissing symbols from mdc-${ name } :` ) ) ;
23
- console . log ( missingSymbols . join ( '\n' ) ) ;
24
- hasFailed = true ;
21
+ const testingName = name + '/testing' ;
22
+ if ( hasTestingPackage ( name ) && hasCorrespondingMdcPackage ( testingName ) ) {
23
+ checkPackage ( testingName ) ;
25
24
}
26
25
} ) ;
27
26
@@ -39,6 +38,17 @@ if (hasFailed) {
39
38
process . exit ( 0 ) ;
40
39
}
41
40
41
+ /** Checks whether the public API of a package matches up with its MDC counterpart. */
42
+ function checkPackage ( name : string ) {
43
+ const missingSymbols = getMissingSymbols ( name , config . skippedExports [ `mdc-${ name } ` ] || [ ] ) ;
44
+
45
+ if ( missingSymbols . length ) {
46
+ console . log ( chalk . redBright ( `\nMissing symbols from mdc-${ name } :` ) ) ;
47
+ console . log ( missingSymbols . join ( '\n' ) ) ;
48
+ hasFailed = true ;
49
+ }
50
+ }
51
+
42
52
/**
43
53
* Gets the names of symbols that are present in a Material package,
44
54
* but not its MDC counterpart.
@@ -90,3 +100,8 @@ function getExports(name: string): string[] {
90
100
function hasCorrespondingMdcPackage ( name : string ) : boolean {
91
101
return existsSync ( join ( __dirname , '../src/material-experimental' , 'mdc-' + name ) ) ;
92
102
}
103
+
104
+ /** Checks whether a particular Material package has a testing sub-package. */
105
+ function hasTestingPackage ( name : string ) : boolean {
106
+ return existsSync ( join ( __dirname , '../src/material' , name , 'testing' ) ) ;
107
+ }
0 commit comments