| 1 |
import * as path from 'path'; |
| 2 |
|
| 3 |
import { fdir as GlobBuilder, PathsOutput } from 'fdir'; |
| 4 |
|
| 5 |
import * as utils from '../../../utils'; |
| 6 |
|
| 7 |
const CWD = path.join(process.cwd(), process.env.BENCHMARK_BASE_DIR as string); |
| 8 |
const PATTERN = process.env.BENCHMARK_PATTERN as string; |
| 9 |
|
| 10 |
const fdir = new GlobBuilder() |
| 11 |
.glob(PATTERN) |
| 12 |
.crawl(CWD); |
| 13 |
|
| 14 |
const timeStart = utils.timeStart(); |
| 15 |
|
| 16 |
fdir.withPromise() |
| 17 |
.then((matches) => { |
| 18 |
const memory = utils.getMemory(); |
| 19 |
const time = utils.timeEnd(timeStart); |
| 20 |
const measures = utils.formatMeasures((matches as PathsOutput).length, time, memory); |
| 21 |
|
| 22 |
console.info(measures); |
| 23 |
}) |
| 24 |
.catch(() => { |
| 25 |
process.exit(0); |
| 26 |
}); |