Skip to content

Commit 1ff400e

Browse files
committed
applied review on glob benchmark
1 parent cb2591a commit 1ff400e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

benchmark/fs/bench-glob.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const common = require('../common');
44
const fs = require('fs');
55
const path = require('path');
6+
const assert = require('node:assert');
67

78
const benchmarkDirectory = path.resolve(__dirname, '..', '..');
89

@@ -20,11 +21,12 @@ async function main(config) {
2021
const fullPath = path.resolve(benchmarkDirectory, config.dir);
2122
const { pattern, recursive, useAsync } = config;
2223

24+
let noDead;
2325
bench.start();
2426

2527
for (let i = 0; i < config.n; i++) {
2628
if (useAsync) {
27-
await new Promise((resolve, reject) => {
29+
noDead = await new Promise((resolve, reject) => {
2830
fs.glob(pattern, { cwd: fullPath, recursive }, (err, files) => {
2931
if (err) {
3032
reject(err);
@@ -34,9 +36,10 @@ async function main(config) {
3436
});
3537
});
3638
} else {
37-
fs.globSync(pattern, { cwd: fullPath, recursive });
39+
noDead = fs.globSync(pattern, { cwd: fullPath, recursive });
3840
}
3941
}
4042

4143
bench.end(config.n);
44+
assert.ok(noDead);
4245
}

0 commit comments

Comments
 (0)