Skip to content

Commit

Permalink
Improve directory expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
nayeemrmn committed Sep 26, 2019
1 parent e9a35d3 commit b48c2d2
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions testing/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ import { isAbsolute, join } from "../fs/path/mod.ts";
import { RunOptions, runTests } from "./mod.ts";
const { DenoError, ErrorKind, args, cwd, exit } = Deno;

const DIR_GLOBS = ["**/?(*_)test.{js,ts}"];

function applyDirGlobs(root: string): string[] {
return DIR_GLOBS.map((s: string): string => `${join(root, s)}`);
}
const DIR_GLOBS = [join("**", "?(*_)test.{js,ts}")];

function showHelp(): void {
console.log(`Deno test runner
Expand All @@ -33,7 +29,7 @@ OPTIONS:
ARGS:
[MODULES...] List of test modules to run.
A directory <dir> will expand to:
${applyDirGlobs("<dir>")
${DIR_GLOBS.map((s: string): string => `${join("<dir>", s)}`)
.join(`
`)}
Defaults to "." when none are provided.
Expand All @@ -60,8 +56,8 @@ function partition(
}

function expandDirectory(dir: string, options: ExpandGlobOptions): WalkInfo[] {
return applyDirGlobs(dir).flatMap((s: string): WalkInfo[] => [
...expandGlobSync(s, options)
return DIR_GLOBS.flatMap((s: string): WalkInfo[] => [
...expandGlobSync(s, { ...options, root: dir })
]);
}

Expand Down

0 comments on commit b48c2d2

Please sign in to comment.