Skip to content

Commit 9862f80

Browse files
let -> const
1 parent 5913f0c commit 9862f80

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

typescript/fetch/run-examples.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,44 +14,44 @@ const srcDir = join(import.meta.dir, 'src');
1414
function findExamples(dir: string): string[] {
1515
const entries = readdirSync(dir);
1616
const files: string[] = [];
17-
17+
1818
for (const entry of entries) {
1919
const fullPath = join(dir, entry);
2020
const stat = statSync(fullPath);
21-
21+
2222
if (stat.isDirectory()) {
2323
files.push(...findExamples(fullPath));
2424
} else if (entry.endsWith('.ts')) {
2525
files.push(fullPath);
2626
}
2727
}
28-
28+
2929
return files.sort();
3030
}
3131

3232
const examples = findExamples(srcDir);
3333
console.log(`Found ${examples.length} example(s)\n`);
3434

35-
let failed = 0;
35+
const failedCountRef = { current: 0 };
3636
for (const example of examples) {
3737
const relativePath = example.replace(import.meta.dir + '/', '');
3838
console.log(`\n${'='.repeat(80)}`);
3939
console.log(`Running: ${relativePath}`);
4040
console.log('='.repeat(80));
41-
41+
4242
try {
4343
await $`bun run ${example}`.quiet();
4444
console.log(`✅ ${relativePath} completed successfully`);
4545
} catch (error) {
4646
console.error(`❌ ${relativePath} failed`);
47-
failed++;
47+
failedCountRef.current++;
4848
}
4949
}
5050

5151
console.log(`\n${'='.repeat(80)}`);
52-
console.log(`Results: ${examples.length - failed}/${examples.length} passed`);
52+
console.log(`Results: ${examples.length - failedCountRef.current}/${examples.length} passed`);
5353
console.log('='.repeat(80));
5454

55-
if (failed > 0) {
55+
if (failedCountRef.current > 0) {
5656
process.exit(1);
5757
}

0 commit comments

Comments
 (0)