File tree Expand file tree Collapse file tree 3 files changed +50
-4
lines changed
Expand file tree Collapse file tree 3 files changed +50
-4
lines changed Original file line number Diff line number Diff line change 11# Unreleased
22
3+ ### Bug Fixes
4+
5+ - If ` src/ ` and ` src/x ` are specified as entry points, ` src/ ` will no longer be ignored, #2121 .
6+
37## v0.23.22 (2022-12-11)
48
59### Features
Original file line number Diff line number Diff line change @@ -148,13 +148,14 @@ export function glob(
148148 do {
149149 const dir = dirs . shift ( ) ! ;
150150
151+ if ( options ?. includeDirectories && mini . match ( dir . join ( "/" ) ) ) {
152+ result . push ( dir . join ( "/" ) ) ;
153+ }
154+
151155 for ( const child of fs . readdirSync ( dir . join ( "/" ) , {
152156 withFileTypes : true ,
153157 } ) ) {
154- if (
155- child . isFile ( ) ||
156- ( options ?. includeDirectories && child . isDirectory ( ) )
157- ) {
158+ if ( child . isFile ( ) ) {
158159 const childPath = [ ...dir , child . name ] . join ( "/" ) ;
159160 if ( mini . match ( childPath ) ) {
160161 result . push ( childPath ) ;
Original file line number Diff line number Diff line change 1+ import { Project , tempdirProject } from "@typestrong/fs-fixture-builder" ;
2+ import { deepStrictEqual as equal } from "assert" ;
3+ import { basename } from "path" ;
4+ import { glob } from "../../lib/utils/fs" ;
5+
6+ describe ( "fs.ts" , ( ) => {
7+ let fix : Project ;
8+ beforeEach ( ( ) => {
9+ fix = tempdirProject ( ) ;
10+ } ) ;
11+
12+ afterEach ( ( ) => {
13+ fix . rm ( ) ;
14+ } ) ;
15+
16+ describe ( "glob" , ( ) => {
17+ it ( "handles root match" , ( ) => {
18+ fix . write ( ) ;
19+
20+ const result = glob ( fix . cwd , fix . cwd , { includeDirectories : true } ) ;
21+ equal ( result , [ fix . cwd ] ) ;
22+ } ) ;
23+
24+ it ( "Handles basic globbing" , ( ) => {
25+ fix . addFile ( "test.ts" ) ;
26+ fix . addFile ( "test2.ts" ) ;
27+ fix . addFile ( "a.ts" ) ;
28+ fix . addFile ( "b.js" ) ;
29+ fix . write ( ) ;
30+
31+ equal (
32+ glob ( `${ fix . cwd } /*.ts` , fix . cwd ) . map ( ( f ) => basename ( f ) ) ,
33+ [ "a.ts" , "test.ts" , "test2.ts" ]
34+ ) ;
35+ equal (
36+ glob ( `**/test*.ts` , fix . cwd ) . map ( ( f ) => basename ( f ) ) ,
37+ [ "test.ts" , "test2.ts" ]
38+ ) ;
39+ } ) ;
40+ } ) ;
41+ } ) ;
You can’t perform that action at this time.
0 commit comments