66import testSubject from '#internal/match-files'
77import toPath from '#internal/to-path'
88import createModuleResolutionHost from '#lib/create-module-resolution-host'
9+ import type { Extensions } from '@flex-development/fst-util-from-fs'
910import * as mlly from '@flex-development/mlly'
1011import type { FileSystem } from '@flex-development/tsconfig-utils'
1112import { alphabetize , identity } from '@flex-development/tutils'
1213import ts from 'typescript'
14+ import tsconfigBuild from '../../../tsconfig.build.json' with { type : 'json' }
1315import tsconfig from '../../../tsconfig.json' with { type : 'json' }
1416
1517describe ( 'unit:internal/matchFiles' , ( ) => {
1618 it . each < [
1719 id : mlly . ModuleId ,
18- extensions : Set < string > | readonly string [ ] | undefined ,
19- exclude : Set < string > | readonly string [ ] | undefined ,
20- include : Set < string > | readonly string [ ] | undefined ,
20+ extensions : Extensions | null | undefined ,
21+ exclude : Set < string > | readonly string [ ] | null | undefined ,
22+ include : Set < string > | readonly string [ ] | null | undefined ,
2123 useCaseSensitiveFileNames ?: boolean | null | undefined ,
2224 depth ?: number | null | undefined ,
23- fs ?: FileSystem | null | undefined
25+ fs ?: Partial < FileSystem > | null | undefined
2426 ] > ( [
25- [
26- new URL ( 'src' , mlly . cwd ( ) ) ,
27- [ '.cjs' , '.cts' , '.js' , '.json' , '.mjs' , '.mts' , '.ts' ] ,
28- tsconfig . exclude ,
29- tsconfig . include ,
30- null ,
31- 0
32- ] ,
3327 [
3428 mlly . cwd ( ) ,
3529 [ '.cjs' , '.cts' , '.js' , '.json' , '.mjs' , '.mts' , '.ts' ] ,
@@ -43,8 +37,22 @@ describe('unit:internal/matchFiles', () => {
4337 tsconfig . include ,
4438 undefined ,
4539 1
40+ ] ,
41+ [
42+ mlly . cwd ( ) ,
43+ [ '.mts' ] ,
44+ tsconfigBuild . exclude ,
45+ tsconfigBuild . include
46+ ] ,
47+ [
48+ new URL ( 'src' , mlly . cwd ( ) ) ,
49+ [ '.cjs' , '.cts' , '.js' , '.json' , '.mjs' , '.mts' , '.ts' ] ,
50+ tsconfig . exclude ,
51+ tsconfig . include ,
52+ null ,
53+ 0
4654 ]
47- ] ) ( 'should return list of files under directory at `id` (%#)' , (
55+ ] ) ( 'should return list of matched files (%#)' , (
4856 id ,
4957 extensions ,
5058 exclude ,
@@ -75,6 +83,6 @@ describe('unit:internal/matchFiles', () => {
7583 )
7684
7785 // Expect
78- expect ( result ) . to . be . an ( 'array' ) . and . eql ( expected ) . and . not . be . frozen
86+ expect ( result ) . to . be . an ( 'array' ) . and . eql ( expected ) . and . be . frozen
7987 } )
8088} )
0 commit comments