Skip to content

Commit

Permalink
Replace glob with recursive readdir
Browse files Browse the repository at this point in the history
  • Loading branch information
niik committed Nov 20, 2024
1 parent b977a61 commit 4b7b0e9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions script/test.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { spawn } from 'child_process'
import { glob } from 'glob'
import { dirname, resolve } from 'path'
import { dirname, resolve, join } from 'path'
import { fileURLToPath } from 'url'
import { readdir } from 'fs/promises'

if (process.argv.some(arg => ['-h', '--help'].includes(arg))) {
console.log(`Usage: ${process.argv0} [kind]`)
Expand All @@ -12,8 +12,11 @@ if (process.argv.some(arg => ['-h', '--help'].includes(arg))) {
}

;(async function (kind) {
const wildcard = kind && kind !== 'all' ? `${kind}/**` : '**'
const files = await glob(`test/${wildcard}/*-test.ts`)
kind ??= 'all'
const files = await readdir(join('test', kind === 'all' ? '.' : kind), {
recursive: true,
}).then(x => x.filter(f => f.endsWith('-test.ts')).map(f => join('test', f)))

const reporterDestinationArgs = ['--test-reporter-destination', 'stdout']
const specTestReporterArgs = [
'--test-reporter',
Expand Down

0 comments on commit 4b7b0e9

Please sign in to comment.