summaryrefslogtreecommitdiff
path: root/cli/js/testing.ts
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2020-04-02 09:26:40 -0400
committerGitHub <noreply@github.com>2020-04-02 09:26:40 -0400
commitc738797944bc7e373b51a04e4332c98010135545 (patch)
treef7f91ebd13df71f125588c9261eba912f27ddc30 /cli/js/testing.ts
parentff0b32f81d4cdbae9fe868a16a8b19227d79c8b1 (diff)
feat: deno test --filter (#4570)
Diffstat (limited to 'cli/js/testing.ts')
-rw-r--r--cli/js/testing.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/cli/js/testing.ts b/cli/js/testing.ts
index 5f1a62c63..5769495b2 100644
--- a/cli/js/testing.ts
+++ b/cli/js/testing.ts
@@ -270,17 +270,17 @@ class TestApi {
}
function createFilterFn(
- only: undefined | string | RegExp,
+ filter: undefined | string | RegExp,
skip: undefined | string | RegExp
): (def: TestDefinition) => boolean {
return (def: TestDefinition): boolean => {
let passes = true;
- if (only) {
- if (only instanceof RegExp) {
- passes = passes && only.test(def.name);
+ if (filter) {
+ if (filter instanceof RegExp) {
+ passes = passes && filter.test(def.name);
} else {
- passes = passes && def.name.includes(only);
+ passes = passes && def.name.includes(filter);
}
}
@@ -299,7 +299,7 @@ function createFilterFn(
export interface RunTestsOptions {
exitOnFail?: boolean;
failFast?: boolean;
- only?: string | RegExp;
+ filter?: string | RegExp;
skip?: string | RegExp;
disableLog?: boolean;
reportToConsole?: boolean;
@@ -309,13 +309,13 @@ export interface RunTestsOptions {
export async function runTests({
exitOnFail = true,
failFast = false,
- only = undefined,
+ filter = undefined,
skip = undefined,
disableLog = false,
reportToConsole: reportToConsole_ = true,
onMessage = undefined,
}: RunTestsOptions = {}): Promise<TestMessage["end"] & {}> {
- const filterFn = createFilterFn(only, skip);
+ const filterFn = createFilterFn(filter, skip);
const testApi = new TestApi(TEST_REGISTRY, filterFn, failFast);
// @ts-ignore