Commit e76e33a 1 parent f83b423 commit e76e33a Copy full SHA for e76e33a
File tree 2 files changed +32
-9
lines changed
2 files changed +32
-9
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,10 @@ describeAllImplementations((implementation) => {
70
70
outputFolder : null ,
71
71
} ) ;
72
72
73
- expect ( console . log ) . not . toHaveBeenCalled ( ) ;
73
+ expect ( console . log ) . toHaveBeenCalledTimes ( 1 ) ;
74
+ expect ( console . log ) . toBeCalledWith (
75
+ expect . stringContaining ( `Only 1 file found for` )
76
+ ) ;
74
77
expect ( exit ) . not . toHaveBeenCalled ( ) ;
75
78
} ) ;
76
79
@@ -126,5 +129,31 @@ describeAllImplementations((implementation) => {
126
129
expect . stringContaining ( `no-generated.scss` )
127
130
) ;
128
131
} ) ;
132
+
133
+ test ( "ignores ignored files" , async ( ) => {
134
+ const pattern = `${ __dirname } /list-different/no-generated.scss` ;
135
+
136
+ await listDifferent ( pattern , {
137
+ banner : "" ,
138
+ watch : false ,
139
+ ignoreInitial : false ,
140
+ exportType : "named" ,
141
+ exportTypeName : "ClassNames" ,
142
+ exportTypeInterface : "Styles" ,
143
+ listDifferent : true ,
144
+ ignore : [ "**/no-generated.scss" ] ,
145
+ implementation,
146
+ quoteType : "single" ,
147
+ updateStaleOnly : false ,
148
+ logLevel : "verbose" ,
149
+ outputFolder : null ,
150
+ } ) ;
151
+
152
+ expect ( exit ) . not . toHaveBeenCalled ( ) ;
153
+ expect ( console . log ) . toHaveBeenCalledTimes ( 1 ) ;
154
+ expect ( console . log ) . toBeCalledWith (
155
+ expect . stringContaining ( `No files found` )
156
+ ) ;
157
+ } ) ;
129
158
} ) ;
130
159
} ) ;
Original file line number Diff line number Diff line change 1
- import glob from "glob" ;
2
1
import fs from "fs" ;
3
2
4
3
import { alerts } from "./alerts" ;
@@ -8,18 +7,13 @@ import {
8
7
classNamesToTypeDefinitions ,
9
8
getTypeDefinitionPath ,
10
9
} from "../typescript" ;
10
+ import { listFilesAndPerformSanityChecks } from "./list-files-and-perform-sanity-checks" ;
11
11
12
12
export const listDifferent = async (
13
13
pattern : string ,
14
14
options : ConfigOptions
15
15
) : Promise < void > => {
16
- // Find all the files that match the provided pattern.
17
- const files = glob . sync ( pattern ) ;
18
-
19
- if ( ! files || ! files . length ) {
20
- alerts . notice ( "No files found." ) ;
21
- return ;
22
- }
16
+ const files = listFilesAndPerformSanityChecks ( pattern , options ) ;
23
17
24
18
// Wait for all the files to be checked.
25
19
await Promise . all ( files . map ( ( file ) => checkFile ( file , options ) ) ) . then (
You can’t perform that action at this time.
0 commit comments