@@ -194,6 +194,25 @@ test('Add dependency to watcher', async t => {
194194 t . true ( add . calledOnce ) ;
195195} ) ;
196196
197+ test ( 'Add dependency to watcher for file added with glob' , async t => {
198+ const fixture = 'test/fixtures/with-partial.css' ;
199+ const glob = 'test/*/+(with|nomatch)*+(partial|nomatch).css' ;
200+ const partial = path . resolve ( 'test/fixtures/partials/partial.css' ) ;
201+ const subPartial = path . resolve ( 'test/fixtures/partials/sub-partial.css' ) ;
202+ const options = { plugins : [ atImport ( { path : [ 'test/fixtures/partials' ] } ) , mixins , simpleVars , cssnano ] } ;
203+ const { preprocessor, add, debug} = mockPreprocessor (
204+ { } ,
205+ { files : [ { pattern : glob , watched : true } ] , autoWatch : true , postcssPreprocessor : { options} }
206+ ) ;
207+ const file = { originalPath : fixture } ;
208+
209+ await preprocessor ( await readFile ( fixture ) , file ) ;
210+ t . true ( debug . secondCall . calledWith ( match ( 'Watching' ) , partial ) ) ;
211+ t . true ( debug . thirdCall . calledWith ( match ( 'Watching' ) , subPartial ) ) ;
212+ t . true ( add . firstCall . calledWith ( match . array . deepEquals ( [ partial , subPartial ] ) ) ) ;
213+ t . true ( add . calledOnce ) ;
214+ } ) ;
215+
197216test ( 'Do not add dependency to watcher if parent is not watched' , async t => {
198217 const fixture = 'test/fixtures/with-partial.css' ;
199218 const options = { plugins : [ atImport ( { path : [ 'test/fixtures/partials' ] } ) , mixins , simpleVars , cssnano ] } ;
0 commit comments