| 1 | import * as path from 'path'; |
| 2 | |
| 3 | import * as glob from '../../../..'; |
| 4 | import * as utils from '../../../utils'; |
| 5 | |
| 6 | const options: glob.Options = { |
| 7 | cwd: path.join(process.cwd(), process.env.BENCHMARK_BASE_DIR as string), |
| 8 | unique: false, |
| 9 | ...JSON.parse(process.env.BENCHMARK_OPTIONS as string) |
| 10 | }; |
| 11 | |
| 12 | const entries: string[] = []; |
| 13 | |
| 14 | const timeStart = utils.timeStart(); |
| 15 | |
| 16 | const stream = glob.stream(process.env.BENCHMARK_PATTERN as string, options); |
| 17 | |
| 18 | stream.once('error', () => process.exit(0)); |
| 19 | stream.on('data', (entry: string) => entries.push(entry)); |
| 20 | stream.once('end', () => { |
| 21 | const memory = utils.getMemory(); |
| 22 | const time = utils.timeEnd(timeStart); |
| 23 | const measures = utils.formatMeasures(entries.length, time, memory); |
| 24 | |
| 25 | console.info(measures); |
| 26 | }); |