@@ -181,23 +181,43 @@ describe("EntryFilesAnalyser", () => {
181181 assert . ok ( to . startsWith ( kFixtureURLPath ) ) ;
182182 }
183183 } ) ;
184- } ) ;
185184
186- it ( "should ignore file that does not exist when option ignoreENOENT is provided" , async ( ) => {
187- const entryFilesAnalyser = new EntryFilesAnalyser ( {
188- ignoreENOENT : true ,
189- rootPath : kFixtureURL
185+ it ( "should automatically build absolute path for entryFiles when rootPath is provided" , async ( ) => {
186+ const entryFilesAnalyser = new EntryFilesAnalyser ( {
187+ rootPath : kFixtureURL
188+ } ) ;
189+
190+ const generator = entryFilesAnalyser . analyse (
191+ [ "recursive/A.js" ]
192+ ) ;
193+ const reports = await fromAsync ( generator ) ;
194+
195+ const files = reports . map ( ( report ) => path . normalize ( report . file ) ) ;
196+ assert . deepEqual (
197+ files ,
198+ [
199+ "recursive/A.js" ,
200+ "recursive/B.js"
201+ ] . map ( ( file ) => path . normalize ( file ) )
202+ ) ;
190203 } ) ;
191204
192- const entryUrl = new URL ( "does-not-exists.js" , kFixtureURL ) ;
205+ it ( "should ignore file that does not exist when option ignoreENOENT is provided" , async ( ) => {
206+ const entryFilesAnalyser = new EntryFilesAnalyser ( {
207+ ignoreENOENT : true ,
208+ rootPath : kFixtureURL
209+ } ) ;
210+
211+ const entryUrl = new URL ( "does-not-exists.js" , kFixtureURL ) ;
193212
194- const generator = entryFilesAnalyser . analyse (
195- [ entryUrl ]
196- ) ;
213+ const generator = entryFilesAnalyser . analyse (
214+ [ entryUrl ]
215+ ) ;
197216
198- const reports = await fromAsync ( generator ) ;
199- assert . strictEqual ( reports . length , 0 ) ;
200- assert . strictEqual ( entryFilesAnalyser . dependencies . hasVertex ( "does-not-exists.js" ) , false ) ;
217+ const reports = await fromAsync ( generator ) ;
218+ assert . strictEqual ( reports . length , 0 ) ;
219+ assert . strictEqual ( entryFilesAnalyser . dependencies . hasVertex ( "does-not-exists.js" ) , false ) ;
220+ } ) ;
201221} ) ;
202222
203223// TODO: replace with Array.fromAsync when droping Node.js 20
0 commit comments