@@ -169,6 +169,7 @@ test("Access project resources via reader w/ builder excludes", async (t) => {
169169 t . is ( ( await excludesProject . getReader ( { style : "flat" } ) . byGlob ( "**/.library" ) ) . length , 0 ,
170170 "Did not find excluded resource for flat style" ) ;
171171
172+ // Excludes are not applied for "runtime" style
172173 t . is ( ( await baselineProject . getReader ( { style : "runtime" } ) . byGlob ( "**/.library" ) ) . length , 1 ,
173174 "Found resource in baseline project for runtime style" ) ;
174175 t . is ( ( await excludesProject . getReader ( { style : "runtime" } ) . byGlob ( "**/.library" ) ) . length , 1 ,
@@ -196,6 +197,196 @@ test("Access project resources via workspace w/ builder excludes", async (t) =>
196197 "Did not find excluded resource for default style" ) ;
197198} ) ;
198199
200+ test ( "Access project resources via reader and workspace w/ absolute builder excludes" , async ( t ) => {
201+ const { projectInput} = t . context ;
202+ const baselineProject = await ( new Library ( ) . init ( projectInput ) ) ;
203+
204+ projectInput . configuration . builder = {
205+ resources : {
206+ excludes : [ "/resources/library/d/.library" ]
207+ }
208+ } ;
209+ const excludesProject = await ( new Library ( ) . init ( projectInput ) ) ;
210+
211+ // We now have two projects: One with excludes and one without
212+ // Always compare the results of both to make sure a file is really excluded because of the
213+ // configuration and not because of a typo or because of it's absence in the fixture
214+
215+ t . is ( ( await baselineProject . getReader ( { } ) . byGlob ( "**/.library" ) ) . length , 1 ,
216+ "Found resource in baseline project for default style" ) ;
217+ t . is ( ( await excludesProject . getReader ( { } ) . byGlob ( "**/.library" ) ) . length , 0 ,
218+ "Did not find excluded resource for default style" ) ;
219+
220+ t . is ( ( await baselineProject . getReader ( { style : "buildtime" } ) . byGlob ( "**/.library" ) ) . length , 1 ,
221+ "Found resource in baseline project for buildtime style" ) ;
222+ t . is ( ( await excludesProject . getReader ( { style : "buildtime" } ) . byGlob ( "**/.library" ) ) . length , 0 ,
223+ "Did not find excluded resource for buildtime style" ) ;
224+
225+ t . is ( ( await baselineProject . getReader ( { style : "dist" } ) . byGlob ( "**/.library" ) ) . length , 1 ,
226+ "Found resource in baseline project for dist style" ) ;
227+ t . is ( ( await excludesProject . getReader ( { style : "dist" } ) . byGlob ( "**/.library" ) ) . length , 0 ,
228+ "Did not find excluded resource for dist style" ) ;
229+
230+ t . is ( ( await baselineProject . getReader ( { style : "flat" } ) . byGlob ( "**/.library" ) ) . length , 1 ,
231+ "Found resource in baseline project for flat style" ) ;
232+ t . is ( ( await excludesProject . getReader ( { style : "flat" } ) . byGlob ( "**/.library" ) ) . length , 0 ,
233+ "Did not find excluded resource for flat style" ) ;
234+
235+ // Excludes are not applied for "runtime" style
236+ t . is ( ( await baselineProject . getReader ( { style : "runtime" } ) . byGlob ( "**/.library" ) ) . length , 1 ,
237+ "Found resource in baseline project for runtime style" ) ;
238+ t . is ( ( await excludesProject . getReader ( { style : "runtime" } ) . byGlob ( "**/.library" ) ) . length , 1 ,
239+ "Found excluded resource for runtime style" ) ;
240+
241+ t . is ( ( await baselineProject . getWorkspace ( ) . byGlob ( "**/.library" ) ) . length , 1 ,
242+ "Found resource in baseline project for default style" ) ;
243+ t . is ( ( await excludesProject . getWorkspace ( ) . byGlob ( "**/.library" ) ) . length , 0 ,
244+ "Did not find excluded resource for default style" ) ;
245+ } ) ;
246+
247+ test ( "Access project resources via reader and workspace w/ incorrect builder excludes" , async ( t ) => {
248+ const { projectInput} = t . context ;
249+ const baselineProject = await ( new Library ( ) . init ( projectInput ) ) ;
250+
251+ projectInput . configuration . builder = {
252+ resources : {
253+ excludes : [ "/.library" ] // Absolute path does not match base path
254+ }
255+ } ;
256+ const excludesProject = await ( new Library ( ) . init ( projectInput ) ) ;
257+
258+ // We now have two projects: One with excludes and one without
259+ // Always compare the results of both to make sure a file is really excluded because of the
260+ // configuration and not because of a typo or because of it's absence in the fixture
261+
262+ t . is ( ( await baselineProject . getReader ( { } ) . byGlob ( "**/.library" ) ) . length , 1 ,
263+ "Found resource in baseline project for default style" ) ;
264+ t . is ( ( await excludesProject . getReader ( { } ) . byGlob ( "**/.library" ) ) . length , 1 ,
265+ "Found resource in project with incorrect exclude for default style" ) ;
266+
267+ t . is ( ( await baselineProject . getReader ( { style : "buildtime" } ) . byGlob ( "**/.library" ) ) . length , 1 ,
268+ "Found resource in baseline project for buildtime style" ) ;
269+ t . is ( ( await excludesProject . getReader ( { style : "buildtime" } ) . byGlob ( "**/.library" ) ) . length , 1 ,
270+ "Found resource in project with incorrect exclude for buildtime style" ) ;
271+
272+ t . is ( ( await baselineProject . getReader ( { style : "dist" } ) . byGlob ( "**/.library" ) ) . length , 1 ,
273+ "Found resource in baseline project for dist style" ) ;
274+ t . is ( ( await excludesProject . getReader ( { style : "dist" } ) . byGlob ( "**/.library" ) ) . length , 1 ,
275+ "Found resource in project with incorrect exclude for dist style" ) ;
276+
277+ t . is ( ( await baselineProject . getReader ( { style : "flat" } ) . byGlob ( "**/.library" ) ) . length , 1 ,
278+ "Can not read any test-resources for flat style" ) ;
279+ t . is ( ( await excludesProject . getReader ( { style : "flat" } ) . byGlob ( "**/.library" ) ) . length , 1 ,
280+ "Can not read any test-resources for flat style" ) ;
281+
282+ // Excludes are not applied for "runtime" style
283+ t . is ( ( await baselineProject . getReader ( { style : "runtime" } ) . byGlob ( "**/.library" ) ) . length , 1 ,
284+ "Found resource in baseline project for runtime style" ) ;
285+ t . is ( ( await excludesProject . getReader ( { style : "runtime" } ) . byGlob ( "**/.library" ) ) . length , 1 ,
286+ "Found resource for runtime style" ) ;
287+
288+ t . is ( ( await baselineProject . getWorkspace ( ) . byGlob ( "**/.library" ) ) . length , 1 ,
289+ "Found resource in baseline project for default style" ) ;
290+ t . is ( ( await excludesProject . getWorkspace ( ) . byGlob ( "**/.library" ) ) . length , 1 ,
291+ "Found resource in project with incorrect exclude for default style" ) ;
292+ } ) ;
293+
294+ test ( "Access project test-resources via reader and workspace w/ absolute builder excludes" , async ( t ) => {
295+ const { projectInput} = t . context ;
296+ const baselineProject = await ( new Library ( ) . init ( projectInput ) ) ;
297+
298+ projectInput . configuration . builder = {
299+ resources : {
300+ excludes : [ "/test-resources/library/d/Test.html" ]
301+ }
302+ } ;
303+ const excludesProject = await ( new Library ( ) . init ( projectInput ) ) ;
304+
305+ // We now have two projects: One with excludes and one without
306+ // Always compare the results of both to make sure a file is really excluded because of the
307+ // configuration and not because of a typo or because of it's absence in the fixture
308+
309+ t . is ( ( await baselineProject . getReader ( { } ) . byGlob ( "**/Test.html" ) ) . length , 1 ,
310+ "Found resource in baseline project for default style" ) ;
311+ t . is ( ( await excludesProject . getReader ( { } ) . byGlob ( "**/Test.html" ) ) . length , 0 ,
312+ "Did not find excluded resource for default style" ) ;
313+
314+ t . is ( ( await baselineProject . getReader ( { style : "buildtime" } ) . byGlob ( "**/Test.html" ) ) . length , 1 ,
315+ "Found resource in baseline project for buildtime style" ) ;
316+ t . is ( ( await excludesProject . getReader ( { style : "buildtime" } ) . byGlob ( "**/Test.html" ) ) . length , 0 ,
317+ "Did not find excluded resource for buildtime style" ) ;
318+
319+ t . is ( ( await baselineProject . getReader ( { style : "dist" } ) . byGlob ( "**/Test.html" ) ) . length , 1 ,
320+ "Found resource in baseline project for dist style" ) ;
321+ t . is ( ( await excludesProject . getReader ( { style : "dist" } ) . byGlob ( "**/Test.html" ) ) . length , 0 ,
322+ "Did not find excluded resource for dist style" ) ;
323+
324+ // Test resources are not available in flat reader
325+ t . is ( ( await baselineProject . getReader ( { style : "flat" } ) . byGlob ( "**/Test.html" ) ) . length , 0 ,
326+ "Can not read any test-resources for flat style" ) ;
327+ t . is ( ( await excludesProject . getReader ( { style : "flat" } ) . byGlob ( "**/Test.html" ) ) . length , 0 ,
328+ "Can not read any test-resources for flat style" ) ;
329+
330+ // Excludes are not applied for "runtime" style
331+ t . is ( ( await baselineProject . getReader ( { style : "runtime" } ) . byGlob ( "**/Test.html" ) ) . length , 1 ,
332+ "Found resource in baseline project for runtime style" ) ;
333+ t . is ( ( await excludesProject . getReader ( { style : "runtime" } ) . byGlob ( "**/Test.html" ) ) . length , 1 ,
334+ "Found excluded resource for runtime style" ) ;
335+
336+ t . is ( ( await baselineProject . getWorkspace ( ) . byGlob ( "**/Test.html" ) ) . length , 1 ,
337+ "Found resource in baseline project for default style" ) ;
338+ t . is ( ( await excludesProject . getWorkspace ( ) . byGlob ( "**/Test.html" ) ) . length , 0 ,
339+ "Did not find excluded resource for default style" ) ;
340+ } ) ;
341+
342+ test ( "Access project test-resources via reader and workspace w/ relative builder excludes" , async ( t ) => {
343+ const { projectInput} = t . context ;
344+ const baselineProject = await ( new Library ( ) . init ( projectInput ) ) ;
345+
346+ projectInput . configuration . builder = {
347+ resources : {
348+ excludes : [ "Test.html" ] // Has no effect since library excludes must be absolute or use wildcards
349+ }
350+ } ;
351+ const excludesProject = await ( new Library ( ) . init ( projectInput ) ) ;
352+
353+ // We now have two projects: One with excludes and one without
354+ // Always compare the results of both to make sure a file is really excluded because of the
355+ // configuration and not because of a typo or because of it's absence in the fixture
356+
357+ t . is ( ( await baselineProject . getReader ( { } ) . byGlob ( "**/Test.html" ) ) . length , 1 ,
358+ "Found resource in baseline project for default style" ) ;
359+ t . is ( ( await excludesProject . getReader ( { } ) . byGlob ( "**/Test.html" ) ) . length , 1 ,
360+ "Did not find excluded resource for default style" ) ;
361+
362+ t . is ( ( await baselineProject . getReader ( { style : "buildtime" } ) . byGlob ( "**/Test.html" ) ) . length , 1 ,
363+ "Found resource in baseline project for buildtime style" ) ;
364+ t . is ( ( await excludesProject . getReader ( { style : "buildtime" } ) . byGlob ( "**/Test.html" ) ) . length , 1 ,
365+ "Did not find excluded resource for buildtime style" ) ;
366+
367+ t . is ( ( await baselineProject . getReader ( { style : "dist" } ) . byGlob ( "**/Test.html" ) ) . length , 1 ,
368+ "Found resource in baseline project for dist style" ) ;
369+ t . is ( ( await excludesProject . getReader ( { style : "dist" } ) . byGlob ( "**/Test.html" ) ) . length , 1 ,
370+ "Did not find excluded resource for dist style" ) ;
371+
372+ // Test resources are not available in flat reader
373+ t . is ( ( await baselineProject . getReader ( { style : "flat" } ) . byGlob ( "**/Test.html" ) ) . length , 0 ,
374+ "Can not read any test-resources for flat style" ) ;
375+ t . is ( ( await excludesProject . getReader ( { style : "flat" } ) . byGlob ( "**/Test.html" ) ) . length , 0 ,
376+ "Can not read any test-resources for flat style" ) ;
377+
378+ // Excludes are not applied for "runtime" style
379+ t . is ( ( await baselineProject . getReader ( { style : "runtime" } ) . byGlob ( "**/Test.html" ) ) . length , 1 ,
380+ "Found resource in baseline project for runtime style" ) ;
381+ t . is ( ( await excludesProject . getReader ( { style : "runtime" } ) . byGlob ( "**/Test.html" ) ) . length , 1 ,
382+ "Found excluded resource for runtime style" ) ;
383+
384+ t . is ( ( await baselineProject . getWorkspace ( ) . byGlob ( "**/Test.html" ) ) . length , 1 ,
385+ "Found resource in baseline project for default style" ) ;
386+ t . is ( ( await excludesProject . getWorkspace ( ) . byGlob ( "**/Test.html" ) ) . length , 1 ,
387+ "Did not find excluded resource for default style" ) ;
388+ } ) ;
389+
199390test ( "Modify project resources via workspace and access via flat and runtime reader" , async ( t ) => {
200391 const { projectInput} = t . context ;
201392 const project = await ( new Library ( ) . init ( projectInput ) ) ;
0 commit comments