@@ -556,6 +556,83 @@ describe.each([
556556 ] )
557557 } ,
558558 )
559+
560+ test (
561+ 'git ignore files outside of a repo are not considered' ,
562+ {
563+ fs : {
564+ // Ignore everything in the "home" directory
565+ 'home/.gitignore' : '*' ,
566+
567+ // Only ignore files called ignore-*.html in the actual git repo
568+ 'home/project/.gitignore' : 'ignore-*.html' ,
569+
570+ 'home/project/package.json' : json `
571+ {
572+ "type": "module",
573+ "dependencies": {
574+ "tailwindcss": "workspace:^",
575+ "@tailwindcss/cli": "workspace:^"
576+ }
577+ }
578+ ` ,
579+
580+ 'home/project/src/index.css' : css ` @import 'tailwindcss'; ` ,
581+ 'home/project/src/index.html' : html `
582+ <div
583+ class="content-['index.html']"
584+ ></div>
585+ ` ,
586+ 'home/project/src/ignore-1.html' : html `
587+ <div
588+ class="content-['ignore-1.html']"
589+ ></div>
590+ ` ,
591+ 'home/project/src/ignore-2.html' : html `
592+ <div
593+ class="content-['ignore-2.html']"
594+ ></div>
595+ ` ,
596+ } ,
597+
598+ installDependencies : false ,
599+ } ,
600+ async ( { fs, root, exec } ) => {
601+ await exec ( `pnpm install --ignore-workspace` , {
602+ cwd : path . join ( root , 'home/project' ) ,
603+ } )
604+
605+ // No git repo = all ignore files are considered
606+ await exec ( `${ command } --input src/index.css --output dist/out.css` , {
607+ cwd : path . join ( root , 'home/project' ) ,
608+ } )
609+
610+ await fs . expectFileNotToContain ( './home/project/dist/out.css' , [
611+ candidate `content-['index.html']` ,
612+ candidate `content-['ignore-1.html']` ,
613+ candidate `content-['ignore-2.html']` ,
614+ ] )
615+
616+ // Make home/project a git repo
617+ // Only ignore files within the repo are considered
618+ await exec ( `git init` , {
619+ cwd : path . join ( root , 'home/project' ) ,
620+ } )
621+
622+ await exec ( `${ command } --input src/index.css --output dist/out.css` , {
623+ cwd : path . join ( root , 'home/project' ) ,
624+ } )
625+
626+ await fs . expectFileToContain ( './home/project/dist/out.css' , [
627+ candidate `content-['index.html']` ,
628+ ] )
629+
630+ await fs . expectFileNotToContain ( './home/project/dist/out.css' , [
631+ candidate `content-['ignore-1.html']` ,
632+ candidate `content-['ignore-2.html']` ,
633+ ] )
634+ } ,
635+ )
559636} )
560637
561638test (
0 commit comments