@@ -6,7 +6,7 @@ import { parseFilePatterns } from "../util/parseFilePatterns.js";
66import type { CLI } from "../types.js" ;
77
88suite ( "parseFilePatterns" , ( ) => {
9- test ( "returns explicit files as absolute paths" , async ( ) => {
9+ test ( "Returns explicit files as absolute paths" , async ( ) => {
1010 const directory = await createTempDirectory ( ) ;
1111 const cwd = process . cwd ( ) ;
1212
@@ -23,7 +23,7 @@ suite("parseFilePatterns", () => {
2323 }
2424 } ) ;
2525
26- test ( "expands directories and filters by supported endings" , async ( ) => {
26+ test ( "Expands directories and filters by supported endings" , async ( ) => {
2727 const directory = await createTempDirectory ( ) ;
2828 const cwd = process . cwd ( ) ;
2929
@@ -50,7 +50,35 @@ suite("parseFilePatterns", () => {
5050 }
5151 } ) ;
5252
53- test ( "expands glob patterns" , async ( ) => {
53+ test ( "Ignores hardcoded directories during directory expansion" , async ( ) => {
54+ const directory = await createTempDirectory ( ) ;
55+ const cwd = process . cwd ( ) ;
56+
57+ try {
58+ await fs . mkdir ( path . join ( directory , "nested" ) ) ;
59+ await fs . mkdir ( path . join ( directory , "node_modules" ) ) ;
60+ await fs . writeFile (
61+ path . join ( directory , "nested" , "one.txt" ) ,
62+ "one" ,
63+ ) ;
64+ await fs . writeFile (
65+ path . join ( directory , "node_modules" , "ignored.txt" ) ,
66+ "ignored" ,
67+ ) ;
68+ process . chdir ( directory ) ;
69+
70+ const files = await parseFilePatterns ( createCLI ( ) , [ "." ] ) ;
71+
72+ assert . deepEqual ( files , [
73+ path . join ( directory , "nested" , "one.txt" ) ,
74+ ] ) ;
75+ } finally {
76+ process . chdir ( cwd ) ;
77+ await cleanupDirectory ( directory ) ;
78+ }
79+ } ) ;
80+
81+ test ( "Expands glob patterns" , async ( ) => {
5482 const directory = await createTempDirectory ( ) ;
5583 const cwd = process . cwd ( ) ;
5684
@@ -76,7 +104,7 @@ suite("parseFilePatterns", () => {
76104 }
77105 } ) ;
78106
79- test ( "expands Windows-style glob patterns on Windows" , async function ( ) {
107+ test ( "Expands Windows-style glob patterns on Windows" , async function ( ) {
80108 if ( path . sep !== "\\" ) {
81109 this . skip ( ) ;
82110 return ;
@@ -107,7 +135,7 @@ suite("parseFilePatterns", () => {
107135 }
108136 } ) ;
109137
110- test ( "deduplicates overlapping patterns" , async ( ) => {
138+ test ( "Deduplicates overlapping patterns" , async ( ) => {
111139 const directory = await createTempDirectory ( ) ;
112140 const cwd = process . cwd ( ) ;
113141
@@ -127,7 +155,7 @@ suite("parseFilePatterns", () => {
127155 }
128156 } ) ;
129157
130- test ( "rejects symbolic links" , async function ( ) {
158+ test ( "Rejects symbolic links" , async function ( ) {
131159 const directory = await createTempDirectory ( ) ;
132160 const cwd = process . cwd ( ) ;
133161
0 commit comments