From ecb7f3cd752f605aa629f8c32aedadb543ef3372 Mon Sep 17 00:00:00 2001 From: Ben Sheridan-Edwards Date: Tue, 15 Sep 2026 15:09:14 +0100 Subject: [PATCH 1/2] feat(config): expose supported runner options --- README.md | 22 ++++++++++ src/cli.ts | 9 +++- src/config.ts | 92 ++++++++++++++++++++++++++++++++++++----- src/index.ts | 12 +++++- src/runner-env.ts | 2 + test/cli.test.ts | 11 ++++- test/config.test.ts | 76 ++++++++++++++++++++++++++++++++++ test/runner-env.test.ts | 2 + 8 files changed, 213 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index c6602a5..2c02094 100644 --- a/README.md +++ b/README.md @@ -317,9 +317,31 @@ npx nativeproof --ios npx nativeproof --android npx nativeproof --project ios npx nativeproof --spec tests/login.spec.ts +npx nativeproof --spec 'tests/{login,settings}.spec.ts' --grep '@smoke' npx nativeproof --no-appium ``` +Runner-native filtering, retries, and reporting stay in `nativeproof.config.ts`: + +```ts +export default defineConfig({ + projects: [/* device projects */], + mochaOpts: { + grep: "@smoke", + retries: 1, // retry a failed test + }, + specFileRetries: 2, // retry a failed spec file + reporters: ["spec", ["junit", { outputDir: "reports" }]], + async afterTest(test, _context, result) { + // NativeProof still captures its default failure evidence before this hook runs. + console.log(`${test.parent} > ${test.title}: ${result.passed ? "passed" : "failed"}`); + }, +}); +``` + +`--spec` accepts comma-separated globs and brace expansions for selecting files. `--grep` overrides +only `mochaOpts.grep` for that invocation, so reporter and retry configuration remains unchanged. + Bin aliases: ```bash diff --git a/src/cli.ts b/src/cli.ts index 1870a64..52aa4f1 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -35,7 +35,7 @@ const tsxLoader = pathToFileURL(packageRequire.resolve("tsx")).href; * * It resolves `nativeproof.config.ts`, ensures the configured Appium server is up (starting one * if needed), and runs the suite with sane env (NATIVEPROOF_PLATFORM / NATIVEPROOF_SPEC / - * NATIVEPROOF_PROJECT) — so a consumer types one command instead of remembering env vars and a runner invocation. The + * NATIVEPROOF_PROJECT / NATIVEPROOF_GREP) — so a consumer types one command instead of remembering env vars and a runner invocation. The * device/emulator itself is the environment (the mobile analogue of needing a display) and is left * to the host. */ @@ -47,6 +47,7 @@ export interface CliArgs { onboardPath: string | undefined; project: string | undefined; spec: string | undefined; + grep: string | undefined; startAppium: boolean; } @@ -57,6 +58,7 @@ const DEFAULTS: CliArgs = { onboardPath: undefined, project: undefined, spec: undefined, + grep: undefined, startAppium: true, }; @@ -116,6 +118,9 @@ export function parseArgs( } else if (arg === "--spec") { i += 1; args.spec = valueFor(argv, i, "--spec"); + } else if (arg === "--grep") { + i += 1; + args.grep = valueFor(argv, i, "--grep"); } else if (arg === "--platform") { i += 1; const platform = valueFor(argv, i, "--platform"); @@ -164,6 +169,7 @@ export function helpText(): string { " --platform platform to run (sets NATIVEPROOF_PLATFORM)", " --project run a named project (sets NATIVEPROOF_PROJECT)", " --spec run only matching specs (sets NATIVEPROOF_SPEC)", + " --grep run tests matching Mocha grep (sets NATIVEPROOF_GREP)", " --no-appium do not auto-start an Appium server", " -h, --help show this help", " -v, --version print the version", @@ -1214,6 +1220,7 @@ export function runnerEnv(args: CliArgs, baseEnv: NodeJS.ProcessEnv = process.en if (args.platform) env.NATIVEPROOF_PLATFORM = args.platform; if (args.project) env.NATIVEPROOF_PROJECT = args.project; if (args.spec) env.NATIVEPROOF_SPEC = args.spec; + if (args.grep) env.NATIVEPROOF_GREP = args.grep; return env; } diff --git a/src/config.ts b/src/config.ts index e4f2c16..ff4a93f 100644 --- a/src/config.ts +++ b/src/config.ts @@ -136,6 +136,48 @@ function hostDeviceDefaults(config: RunnerConfig, project: DeviceProject): Recor : {}; } +/** Runner-native Mocha options forwarded without inventing a NativeProof test DSL. */ +export interface RunnerMochaOptions { + require?: string[]; + compilers?: string[]; + allowUncaught?: boolean; + asyncOnly?: boolean; + bail?: boolean; + checkLeaks?: boolean; + delay?: boolean; + fgrep?: string; + forbidOnly?: boolean; + forbidPending?: boolean; + fullTrace?: boolean; + global?: string[]; + grep?: RegExp | string; + invert?: boolean; + retries?: number; + timeout?: number | string; + ui?: "bdd" | "tdd" | "qunit" | "exports"; +} + +/** A built-in or installed WebdriverIO reporter, optionally with reporter-native options. */ +export type RunnerReporter = string | [string, Record]; + +export interface RunnerTest { + title: string; + parent: string; + [key: string]: unknown; +} + +export interface RunnerTestResult { + passed: boolean; + [key: string]: unknown; +} + +/** Consumer hook composed after NativeProof's built-in failure evidence capture. */ +export type RunnerAfterTestHook = ( + test: RunnerTest, + context: unknown, + result: RunnerTestResult, +) => unknown | Promise; + /** The device/run config the CLI turns into a WebdriverIO run. */ export interface RunnerConfig { /** Directory holding the specs (default "tests"). */ @@ -150,6 +192,18 @@ export interface RunnerConfig { }; /** Per-test timeout in ms (default 240000). */ mochaTimeout?: number; + /** Runner-native Mocha configuration. CLI `--grep` overrides only `mochaOpts.grep`. */ + mochaOpts?: RunnerMochaOptions; + /** Number of retries for a failed spec file. */ + specFileRetries?: number; + /** Delay in seconds before retrying a failed spec file. */ + specFileRetriesDelay?: number; + /** Defer failed spec retries until the end of the queue. */ + specFileRetriesDeferred?: boolean; + /** WebdriverIO reporters. Defaults to NativeProof's spec reporter. */ + reporters?: RunnerReporter[]; + /** Consumer lifecycle hook; failure capture still runs first. */ + afterTest?: RunnerAfterTestHook; /** * WebdriverIO pass-throughs for tuning real-device runs. Each is forwarded only when set, so * WebdriverIO's own defaults apply otherwise. Slow software-GPU emulators in particular often @@ -185,6 +239,7 @@ export interface RunnerEnv { platform?: string; project?: string; spec?: string; + grep?: string; } /** Pick the project by explicit name, else by platform (loudly failing on no match), else the first one. */ @@ -256,6 +311,21 @@ export function projectCapabilities(config: RunnerConfig, project: DeviceProject }; } +type FailureCapture = (prefix: string) => Promise; + +/** @internal Compose public hooks without allowing them to replace default evidence capture. */ +export function composeAfterTest( + consumerHook?: RunnerAfterTestHook, + captureFailure: FailureCapture = captureState, +): RunnerAfterTestHook { + return async (test, context, result) => { + if (!result.passed) { + await captureFailure(failureEvidenceName(test)).catch(() => {}); + } + await consumerHook?.(test, context, result); + }; +} + /** * Translate an NativeProof config into a WebdriverIO `config` object. */ @@ -280,20 +350,18 @@ export function buildWdioConfig( maxInstances: 1, capabilities: [capabilities], framework: "mocha", - reporters: ["spec"], - mochaOpts: { ui: "bdd", timeout: config.mochaTimeout ?? 240_000 }, + reporters: config.reporters ?? ["spec"], + mochaOpts: { + ui: "bdd", + timeout: config.mochaTimeout ?? 240_000, + ...config.mochaOpts, + ...(env.grep ? { grep: env.grep } : {}), + }, // Evidence on failure, out of the box: on a failed behaviour, snapshot a screenshot + // redacted page source into the artifact dir, named after the spec. Best-effort — a // capture error never masks the real failure — and consumers get it without writing // their own afterTest hook. - afterTest: async ( - test: { title: string; parent: string }, - _context: unknown, - result: { passed: boolean }, - ): Promise => { - if (result.passed) return; - await captureState(failureEvidenceName(test)).catch(() => {}); - }, + afterTest: composeAfterTest(config.afterTest), }; // Optional WebdriverIO tuning — forwarded only when the consumer set it, so wdio's defaults apply // otherwise (real emulators/simulators often need longer connection/wait timeouts than the defaults). @@ -303,6 +371,10 @@ export function buildWdioConfig( if (config.waitforTimeout !== undefined) wdio.waitforTimeout = config.waitforTimeout; if (config.bail !== undefined) wdio.bail = config.bail; if (config.logLevel !== undefined) wdio.logLevel = config.logLevel; + if (config.specFileRetries !== undefined) wdio.specFileRetries = config.specFileRetries; + if (config.specFileRetriesDelay !== undefined) wdio.specFileRetriesDelay = config.specFileRetriesDelay; + if (config.specFileRetriesDeferred !== undefined) + wdio.specFileRetriesDeferred = config.specFileRetriesDeferred; return wdio; } diff --git a/src/index.ts b/src/index.ts index eb0431f..99a5efa 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,7 +17,17 @@ export type { SessionContext, } from "./app.js"; export { defineApp } from "./app.js"; -export type { AppiumOptions, DeviceProject, NativeProofConfig, RunnerConfig } from "./config.js"; +export type { + AppiumOptions, + DeviceProject, + NativeProofConfig, + RunnerAfterTestHook, + RunnerConfig, + RunnerMochaOptions, + RunnerReporter, + RunnerTest, + RunnerTestResult, +} from "./config.js"; export { defineConfig } from "./config.js"; export type { Driver, Platform } from "./driver.js"; export { wdioDriver } from "./driver.js"; diff --git a/src/runner-env.ts b/src/runner-env.ts index 2f7f483..1558f27 100644 --- a/src/runner-env.ts +++ b/src/runner-env.ts @@ -42,5 +42,7 @@ export function runnerEnvFromProcess( const spec = envValue(env, "NATIVEPROOF_SPEC", "SPEC", warn); if (spec) selection.spec = spec; } + const grep = env.NATIVEPROOF_GREP; + if (grep) selection.grep = grep; return selection; } diff --git a/test/cli.test.ts b/test/cli.test.ts index 3c36f3b..cb1aef8 100644 --- a/test/cli.test.ts +++ b/test/cli.test.ts @@ -52,7 +52,7 @@ test("parseArgs defaults to the test command with sensible defaults", () => { assert.equal(args.initPlatform, undefined); }); -test("parseArgs reads platform, project, spec and --no-appium", () => { +test("parseArgs reads platform, project, spec, grep and --no-appium", () => { const args = parseArgs([ "test", "--platform", @@ -61,12 +61,15 @@ test("parseArgs reads platform, project, spec and --no-appium", () => { "tablet", "--spec", "a.spec.ts", + "--grep", + "@smoke", "--no-appium", ]); assert.equal(args.platform, "ios"); assert.equal(args.initPlatform, "ios"); assert.equal(args.project, "tablet"); assert.equal(args.spec, "a.spec.ts"); + assert.equal(args.grep, "@smoke"); assert.equal(args.startAppium, false); }); @@ -246,9 +249,15 @@ test("loadNativeProofConfig errors when the config has no default export", async test("helpText names the native E2E layer and version is semver", () => { assert.match(helpText(), /Playwright-feeling native mobile E2E/); + assert.match(helpText(), /--grep /); assert.match(version(), /^\d+\.\d+\.\d+$/); }); +test("runnerEnv forwards grep through a NativeProof-prefixed variable", () => { + const env = runnerEnv(parseArgs(["--grep", "@smoke"]), {}); + assert.equal(env.NATIVEPROOF_GREP, "@smoke"); +}); + test("package carries the runtime reporter dependency used by generated WDIO config", () => { const pkg = JSON.parse(readFileSync(path.join(process.cwd(), "package.json"), "utf8")) as { dependencies?: Record; diff --git a/test/config.test.ts b/test/config.test.ts index 80b1977..9ddb75a 100644 --- a/test/config.test.ts +++ b/test/config.test.ts @@ -7,6 +7,7 @@ import type { App, ScreenFactories } from "../src/app.js"; import { bootedIosSimulatorFromSimctl, buildWdioConfig, + composeAfterTest, defineConfig, findConfigFile, resolveProject, @@ -226,6 +227,81 @@ test("buildWdioConfig forwards wdio tuning options only when set", () => { assert.equal(tuned.logLevel, "warn"); }); +test("buildWdioConfig forwards runner-native retries, reporters and Mocha options", () => { + const afterTest = async (): Promise => {}; + const wdio = buildWdioConfig( + { + projects, + specFileRetries: 2, + specFileRetriesDelay: 5, + specFileRetriesDeferred: false, + reporters: ["spec", ["junit", { outputDir: "reports" }]], + mochaOpts: { + grep: "@smoke", + invert: true, + retries: 1, + require: ["./tests/setup.ts"], + timeout: 30_000, + }, + afterTest, + }, + {}, + "/p", + ); + + assert.equal(wdio.specFileRetries, 2); + assert.equal(wdio.specFileRetriesDelay, 5); + assert.equal(wdio.specFileRetriesDeferred, false); + assert.deepEqual(wdio.reporters, ["spec", ["junit", { outputDir: "reports" }]]); + assert.deepEqual(wdio.mochaOpts, { + ui: "bdd", + timeout: 30_000, + grep: "@smoke", + invert: true, + retries: 1, + require: ["./tests/setup.ts"], + }); + assert.notEqual(wdio.afterTest, afterTest, "the user hook is composed instead of replacing capture"); +}); + +test("CLI grep overrides config grep without replacing other Mocha options", () => { + const wdio = buildWdioConfig( + { + projects, + mochaOpts: { grep: "@regression", retries: 2, timeout: 20_000 }, + }, + { grep: "@smoke" }, + "/p", + ); + + assert.deepEqual(wdio.mochaOpts, { + ui: "bdd", + timeout: 20_000, + grep: "@smoke", + retries: 2, + }); +}); + +test("composeAfterTest captures failures before the consumer hook and keeps capture best-effort", async () => { + const events: string[] = []; + const hook = composeAfterTest( + async () => { + events.push("consumer"); + }, + async () => { + events.push("capture"); + throw new Error("device disconnected during evidence capture"); + }, + ); + + await hook({ title: "fails", parent: "suite" }, {}, { passed: false }); + assert.deepEqual(events, ["capture", "consumer"]); + + events.length = 0; + await hook({ title: "passes", parent: "suite" }, {}, { passed: true }); + assert.deepEqual(events, ["consumer"]); +}); + test("buildWdioConfig lets nativeproof.config.ts own the artifact directory", async () => { const dir = mkdtempSync(path.join(tmpdir(), "nativeproof-artifacts-")); const configuredDir = path.join(dir, "configured"); diff --git a/test/runner-env.test.ts b/test/runner-env.test.ts index 005dcd8..1836e8a 100644 --- a/test/runner-env.test.ts +++ b/test/runner-env.test.ts @@ -17,6 +17,7 @@ test("runner env prefers NativeProof-prefixed selection vars", () => { PLATFORM: "android", NATIVEPROOF_PROJECT: "tablet", NATIVEPROOF_SPEC: "tests/login.spec.ts", + NATIVEPROOF_GREP: "@smoke", SPEC: "tests/ambient.spec.ts", }, { warn }, @@ -25,6 +26,7 @@ test("runner env prefers NativeProof-prefixed selection vars", () => { platform: "ios", project: "tablet", spec: "tests/login.spec.ts", + grep: "@smoke", }, ); assert.deepEqual(warnings, []); From 5ab8af8c6d0d04fb907cc527d3903d4004fdde37 Mon Sep 17 00:00:00 2001 From: Ben Sheridan-Edwards Date: Tue, 15 Sep 2026 15:37:28 +0100 Subject: [PATCH 2/2] fix(config): use native runner types (#148) --- package-lock.json | 1 + package.json | 1 + src/cli.ts | 2 +- src/config.ts | 24 +++++---------- src/runner-env.ts | 2 +- test/cli.test.ts | 8 ++++- test/config.test.ts | 52 ++++++++++++++++++++++++++++++-- test/public-runner-types.test.ts | 32 ++++++++++++++++++++ test/runner-env.test.ts | 4 +++ 9 files changed, 105 insertions(+), 21 deletions(-) create mode 100644 test/public-runner-types.test.ts diff --git a/package-lock.json b/package-lock.json index 643f1f3..88d997c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "@wdio/local-runner": "^9.29.1", "@wdio/mocha-framework": "^9.29.1", "@wdio/spec-reporter": "^9.29.1", + "@wdio/types": "^9.29.1", "appium": "^3.5.2", "tsx": "^4.22.4", "webdriverio": "^9.21.1", diff --git a/package.json b/package.json index eef03d0..f748939 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "@wdio/local-runner": "^9.29.1", "@wdio/mocha-framework": "^9.29.1", "@wdio/spec-reporter": "^9.29.1", + "@wdio/types": "^9.29.1", "appium": "^3.5.2", "tsx": "^4.22.4", "webdriverio": "^9.21.1", diff --git a/src/cli.ts b/src/cli.ts index 52aa4f1..d233db1 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -1220,7 +1220,7 @@ export function runnerEnv(args: CliArgs, baseEnv: NodeJS.ProcessEnv = process.en if (args.platform) env.NATIVEPROOF_PLATFORM = args.platform; if (args.project) env.NATIVEPROOF_PROJECT = args.project; if (args.spec) env.NATIVEPROOF_SPEC = args.spec; - if (args.grep) env.NATIVEPROOF_GREP = args.grep; + if (args.grep !== undefined) env.NATIVEPROOF_GREP = args.grep; return env; } diff --git a/src/config.ts b/src/config.ts index ff4a93f..16b85fc 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,6 +1,7 @@ import { execFileSync } from "node:child_process"; import { existsSync } from "node:fs"; import path from "node:path"; +import type { Frameworks, Reporters, Services } from "@wdio/types"; import type { App } from "./app.js"; import { captureState, failureEvidenceName, setArtifactDir } from "./evidence.js"; @@ -158,25 +159,16 @@ export interface RunnerMochaOptions { } /** A built-in or installed WebdriverIO reporter, optionally with reporter-native options. */ -export type RunnerReporter = string | [string, Record]; +export type RunnerReporter = Reporters.ReporterEntry; -export interface RunnerTest { - title: string; - parent: string; - [key: string]: unknown; -} +/** WebdriverIO's complete runner test payload. */ +export type RunnerTest = Frameworks.Test; -export interface RunnerTestResult { - passed: boolean; - [key: string]: unknown; -} +/** WebdriverIO's complete runner result payload, including retries, duration, status, and error. */ +export type RunnerTestResult = Frameworks.TestResult; /** Consumer hook composed after NativeProof's built-in failure evidence capture. */ -export type RunnerAfterTestHook = ( - test: RunnerTest, - context: unknown, - result: RunnerTestResult, -) => unknown | Promise; +export type RunnerAfterTestHook = NonNullable; /** The device/run config the CLI turns into a WebdriverIO run. */ export interface RunnerConfig { @@ -355,7 +347,7 @@ export function buildWdioConfig( ui: "bdd", timeout: config.mochaTimeout ?? 240_000, ...config.mochaOpts, - ...(env.grep ? { grep: env.grep } : {}), + ...(env.grep !== undefined ? { grep: env.grep } : {}), }, // Evidence on failure, out of the box: on a failed behaviour, snapshot a screenshot + // redacted page source into the artifact dir, named after the spec. Best-effort — a diff --git a/src/runner-env.ts b/src/runner-env.ts index 1558f27..1840b2d 100644 --- a/src/runner-env.ts +++ b/src/runner-env.ts @@ -43,6 +43,6 @@ export function runnerEnvFromProcess( if (spec) selection.spec = spec; } const grep = env.NATIVEPROOF_GREP; - if (grep) selection.grep = grep; + if (grep !== undefined) selection.grep = grep; return selection; } diff --git a/test/cli.test.ts b/test/cli.test.ts index cb1aef8..c11cbfb 100644 --- a/test/cli.test.ts +++ b/test/cli.test.ts @@ -258,12 +258,18 @@ test("runnerEnv forwards grep through a NativeProof-prefixed variable", () => { assert.equal(env.NATIVEPROOF_GREP, "@smoke"); }); -test("package carries the runtime reporter dependency used by generated WDIO config", () => { +test("runnerEnv lets an explicit empty --grep clear an inherited filter", () => { + const env = runnerEnv(parseArgs(["--grep", ""]), { NATIVEPROOF_GREP: "@inherited" }); + assert.equal(env.NATIVEPROOF_GREP, ""); +}); + +test("package carries the runtime reporter and public WDIO type dependencies", () => { const pkg = JSON.parse(readFileSync(path.join(process.cwd(), "package.json"), "utf8")) as { dependencies?: Record; }; assert.equal(typeof pkg.dependencies?.["@wdio/spec-reporter"], "string"); + assert.equal(typeof pkg.dependencies?.["@wdio/types"], "string"); }); test("Appium driver helpers map platforms and parse installed-driver output", () => { diff --git a/test/config.test.ts b/test/config.test.ts index 9ddb75a..69937e0 100644 --- a/test/config.test.ts +++ b/test/config.test.ts @@ -282,8 +282,36 @@ test("CLI grep overrides config grep without replacing other Mocha options", () }); }); +test("an explicit empty CLI grep clears config grep without replacing other Mocha options", () => { + const wdio = buildWdioConfig( + { + projects, + mochaOpts: { grep: "@regression", retries: 2, timeout: 20_000 }, + }, + { grep: "" }, + "/p", + ); + + assert.deepEqual(wdio.mochaOpts, { + ui: "bdd", + timeout: 20_000, + grep: "", + retries: 2, + }); +}); + test("composeAfterTest captures failures before the consumer hook and keeps capture best-effort", async () => { const events: string[] = []; + const runnerTest = { + type: "test", + title: "fails", + parent: "suite", + fullTitle: "suite fails", + fullName: "suite fails", + pending: false, + file: "tests/failure.spec.ts", + ctx: {}, + }; const hook = composeAfterTest( async () => { events.push("consumer"); @@ -294,11 +322,31 @@ test("composeAfterTest captures failures before the consumer hook and keeps capt }, ); - await hook({ title: "fails", parent: "suite" }, {}, { passed: false }); + await hook( + runnerTest, + {}, + { + passed: false, + duration: 1, + retries: { limit: 0, attempts: 0 }, + exception: "failure", + status: "failed", + }, + ); assert.deepEqual(events, ["capture", "consumer"]); events.length = 0; - await hook({ title: "passes", parent: "suite" }, {}, { passed: true }); + await hook( + { ...runnerTest, title: "passes", fullTitle: "suite passes", fullName: "suite passes" }, + {}, + { + passed: true, + duration: 1, + retries: { limit: 0, attempts: 0 }, + exception: "", + status: "passed", + }, + ); assert.deepEqual(events, ["consumer"]); }); diff --git a/test/public-runner-types.test.ts b/test/public-runner-types.test.ts new file mode 100644 index 0000000..cf321ea --- /dev/null +++ b/test/public-runner-types.test.ts @@ -0,0 +1,32 @@ +import assert from "node:assert/strict"; +import { EventEmitter } from "node:events"; +import { test } from "node:test"; +import type { Reporters } from "@wdio/types"; +import { defineConfig } from "../src/config.js"; + +class CustomReporter extends EventEmitter { + isSynchronised = true; + + constructor(_options: Partial) { + super(); + } +} + +test("public runner types accept WDIO reporter classes and complete afterTest payloads", () => { + const config = defineConfig({ + projects: [{ name: "ios", platform: "ios" }], + reporters: [CustomReporter], + afterTest: async (runnerTest, _context, result) => { + const fullName: string = runnerTest.fullName; + const file: string = runnerTest.file; + const attempts: number = result.retries.attempts; + const duration: number = result.duration; + const status: string = result.status; + const errorMessage: unknown = result.error?.message; + void [fullName, file, attempts, duration, status, errorMessage]; + }, + }); + + assert.equal(config.reporters?.[0], CustomReporter); + assert.equal(typeof config.afterTest, "function"); +}); diff --git a/test/runner-env.test.ts b/test/runner-env.test.ts index 1836e8a..fd9aff5 100644 --- a/test/runner-env.test.ts +++ b/test/runner-env.test.ts @@ -44,3 +44,7 @@ test("runner env warns when legacy bare vars are used", () => { "nativeproof: SPEC is deprecated for runner selection; use NATIVEPROOF_SPEC instead", ]); }); + +test("runner env preserves a defined empty grep override", () => { + assert.deepEqual(runnerEnvFromProcess({ NATIVEPROOF_GREP: "" }), { grep: "" }); +});