feat: update tests

feat: update tests

feat: update tests
This commit is contained in:
2023-05-30 16:12:00 +02:00
parent d6d4f6e5c4
commit 0d60b8bfad
87 changed files with 1021 additions and 823 deletions

View File

@@ -0,0 +1,19 @@
import path from 'path';
import {readdirSync, statSync} from 'fs';
/**
* Expand a path to a list of all files deeply contained in it
*/
export function expandPathToFilesSync(sourcePath: string, accept: (fileName: string) => boolean): string[] {
const fullPath = path.resolve(sourcePath);
const directory = statSync(fullPath);
return directory.isDirectory()
? // eslint-disable-next-line unicorn/prefer-spread
([] as string[]).concat(
...readdirSync(fullPath).map(fragment =>
expandPathToFilesSync(path.resolve(sourcePath, fragment), accept),
),
)
: [fullPath].filter(accept);
}