From 504430f88a9f473857506f5e0446b002699b1db1 Mon Sep 17 00:00:00 2001 From: Ryan Lee Date: Tue, 13 Jun 2023 13:15:14 -0400 Subject: [PATCH] feat: add test skip arg (#19) --- main.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/main.ts b/main.ts index de31ef3..a466e60 100644 --- a/main.ts +++ b/main.ts @@ -17,7 +17,7 @@ type Run = ( t: Omit, ) => (pathname: string, logs: Buffer) => Promise -const globalRunner = (f: Run) => { +const globalRunner = (f: Run, skipArg: string) => { return async ({ concurrency, skip, ...rest }: T, includePatterns: string) => { const include: string[] = [] for await ( @@ -44,7 +44,8 @@ const globalRunner = (f: Run) => { include.map((pathname) => async () => { const { frontmatter } = parseFrontmatter(pathname, await Deno.readTextFile(pathname), { test_skip(value) { - return value !== undefined + const skipArgs = new Set(value?.split(" ") ?? []) + return value === "" || skipArgs.has(skipArg) }, }) const quotedPathname = `"${pathname}"` @@ -92,15 +93,15 @@ await new Command() .command("deno") .arguments("") .option("-r, --reload ", "reload") - .action(globalRunner(runDeno)) + .action(globalRunner(runDeno, "deno")) .command("node") .arguments("") - .action(globalRunner(runNode)) + .action(globalRunner(runNode, "node")) .command("browser") .arguments("") .option("-b, --browser ", "browser binary") .option("-p, --project ", "project", { required: true }) .option("-r, --reload ", "reload", { required: true }) - .action(globalRunner(runBrowser)), + .action(globalRunner(runBrowser, "browser")), ) .parse(Deno.args)