File tree Expand file tree Collapse file tree 2 files changed +12
-13
lines changed Expand file tree Collapse file tree 2 files changed +12
-13
lines changed Original file line number Diff line number Diff line change 1
1
// @ts -check
2
2
const childProcess = require ( 'child_process' )
3
+ const glob = require ( 'fast-glob' )
3
4
const fs = require ( 'fs' )
4
- const glob = require ( 'glob' )
5
5
const path = require ( 'path' ) . posix
6
6
const { logAndThrow } = require ( './util' )
7
7
const { error, info, verbose } = require ( './logger' )
@@ -160,15 +160,14 @@ function coverageFilePatterns() {
160
160
*
161
161
* @param {string } projectRoot
162
162
* @param {string[] } coverageFilePatterns
163
- * @returns {string[] }
163
+ * @returns {Promise< string[]> }
164
164
*/
165
- function getCoverageFiles ( projectRoot , coverageFilePatterns ) {
166
- return coverageFilePatterns . flatMap (
167
- /** @type {string } */ pattern => {
168
- return glob . sync ( `**/${ pattern } ` , {
169
- cwd : projectRoot ,
170
- ignore : globBlacklist ( ) ,
171
- } )
165
+ async function getCoverageFiles ( projectRoot , coverageFilePatterns ) {
166
+ return glob (
167
+ coverageFilePatterns . map ( pattern => `**/${ pattern } ` ) ,
168
+ {
169
+ cwd : projectRoot ,
170
+ ignore : globBlacklist ( ) ,
172
171
} ,
173
172
)
174
173
}
Original file line number Diff line number Diff line change @@ -81,8 +81,8 @@ describe('File Helpers', () => {
81
81
expect ( reportContents ) . toBe ( 'I am test coverage data' )
82
82
} )
83
83
84
- it ( 'can return a list of coverage files' , ( ) => {
85
- const results = fileHelpers . getCoverageFiles (
84
+ it ( 'can return a list of coverage files' , async ( ) => {
85
+ const results = await fileHelpers . getCoverageFiles (
86
86
'.' ,
87
87
fileHelpers . coverageFilePatterns ( ) ,
88
88
)
@@ -94,9 +94,9 @@ describe('File Helpers', () => {
94
94
expect ( results ) . toContain ( 'test/fixtures/other/fake.codecov.txt' )
95
95
} )
96
96
97
- it ( 'can return a list of coverage files with a pattern' , ( ) => {
97
+ it ( 'can return a list of coverage files with a pattern' , async ( ) => {
98
98
expect (
99
- fileHelpers . getCoverageFiles ( '.' , [ 'index.test.js' ] ) ,
99
+ await fileHelpers . getCoverageFiles ( '.' , [ 'index.test.js' ] ) ,
100
100
) . toStrictEqual ( [ 'test/index.test.js' , 'test/providers/index.test.js' ] )
101
101
} )
102
102
describe ( 'coverage file patterns' , ( ) => {
You can’t perform that action at this time.
0 commit comments