test: use node helpers for events.once and setTimeout promise (#37374)
This commit is contained in:
parent
46c8b9c728
commit
a3e3efe4c4
47 changed files with 932 additions and 927 deletions
|
@ -1,5 +1,5 @@
|
|||
import { once } from 'events';
|
||||
import * as walkdir from 'walkdir';
|
||||
import { emittedOnce } from './lib/events-helpers';
|
||||
|
||||
export async function getFiles (directoryPath: string, { filter = null }: {filter?: ((file: string) => boolean) | null} = {}) {
|
||||
const files: string[] = [];
|
||||
|
@ -9,6 +9,6 @@ export async function getFiles (directoryPath: string, { filter = null }: {filte
|
|||
walker.on('file', (file) => {
|
||||
if (!filter || filter(file)) { files.push(file); }
|
||||
});
|
||||
await emittedOnce(walker, 'end');
|
||||
await once(walker, 'end');
|
||||
return files;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue