@@ -20,6 +20,7 @@ import {
2020 defaultConcurrency ,
2121 docReaderTests ,
2222 gitLines ,
23+ ignoredCheckInputs ,
2324 runSteps ,
2425 splitTests ,
2526 type Step ,
@@ -271,16 +272,17 @@ function fixture(remotes: Record<string, "A" | "B">) {
271272 } ;
272273}
273274
274- const compare = ( root : string , ref : Option . Option < string > ) =>
275+ const inFixture = < A , E > ( effect : Effect . Effect < A , E , ChildProcessSpawner . ChildProcessSpawner > ) =>
275276 Effect . gen ( function * ( ) {
276277 const spawner = yield * ChildProcessSpawner . ChildProcessSpawner ;
277- return yield * comparisonBase ( root , ref ) . pipe (
278+ return yield * effect . pipe (
278279 Effect . provideService (
279280 ChildProcessSpawner . ChildProcessSpawner ,
280281 ChildProcessSpawner . make ( ( command ) => spawner . spawn ( ChildProcess . setEnv ( command , env ) ) ) ,
281282 ) ,
282283 ) ;
283284 } ) . pipe ( Effect . provide ( NodeServices . layer ) , Effect . runPromise ) ;
285+ const compare = ( root : string , ref : Option . Option < string > ) => inFixture ( comparisonBase ( root , ref ) ) ;
284286
285287it . each ( [ "upstream" , "team/upstream" ] ) (
286288 "compares against %s/main when the fork's origin/main lags it" ,
@@ -299,6 +301,44 @@ it("compares against an explicit ref instead of the closest remote main", async
299301 assert . strictEqual ( result . ref , "origin/main" ) ;
300302} ) ;
301303
304+ it ( "lists the ignored inputs that main's pathspecs list, without entering node_modules" , async ( ) => {
305+ using project = fixture ( { } ) ;
306+ const git = ( ...args : Array < string > ) =>
307+ NodeChildProcess . execFileSync ( "git" , args , { cwd : project . root , encoding : "utf8" , env } ) ;
308+ const write = ( file : string , content = "" ) => {
309+ NodeFS . mkdirSync ( NodePath . dirname ( NodePath . join ( project . root , file ) ) , { recursive : true } ) ;
310+ NodeFS . writeFileSync ( NodePath . join ( project . root , file ) , content ) ;
311+ } ;
312+ write ( ".gitignore" , "node_modules/\ndist/\n.generated/\n.env*\n*.gen.d.ts\nreplaced/\nskipped/" ) ;
313+ for ( const file of [ "replaced" , "skipped" ] ) write ( file ) ;
314+ git ( "add" , "." ) ;
315+ git ( "commit" , "-m" , "files that directories replace" ) ;
316+ git ( "update-index" , "--skip-worktree" , "skipped" ) ;
317+ for ( const file of [ "replaced" , "skipped" ] ) NodeFS . rmSync ( NodePath . join ( project . root , file ) ) ;
318+ for ( const file of [
319+ ".env.local" ,
320+ "src/types.gen.d.ts" ,
321+ "src/.generated/routes.ts" ,
322+ "dist/index.d.ts" ,
323+ "dist/node_modules/pkg/index.d.ts" ,
324+ "node_modules/pkg/index.d.ts" ,
325+ // A package folder left behind by a branch switch.
326+ "old/dist/a.d.ts" ,
327+ "old/node_modules/pkg/index.d.ts" ,
328+ "replaced/sub/a.d.ts" ,
329+ "skipped/a.d.ts" ,
330+ ] )
331+ write ( file ) ;
332+ const command =
333+ "ls-files -o -i --exclude-standard -- :(glob)**/.generated/** :(glob)**/.astro/** :(glob)**/*.d.ts :(glob)**/.env* :(exclude,glob)**/node_modules/**" ;
334+ const old = git ( ...command . split ( " " ) )
335+ . split ( "\n" )
336+ . filter ( Boolean )
337+ . sort ( ) ;
338+ assert . includeMembers ( old , [ "old/dist/a.d.ts" , "replaced/sub/a.d.ts" , "skipped/a.d.ts" ] ) ;
339+ assert . deepStrictEqual ( await inFixture ( ignoredCheckInputs ( project . root ) ) , old ) ;
340+ } ) ;
341+
302342function launcherFixture ( ) {
303343 const root = NodeFS . realpathSync (
304344 NodeFS . mkdtempSync ( NodePath . join ( NodeOS . tmpdir ( ) , "t3 checks & (fixture) " ) ) ,
0 commit comments