Skip to content

Commit

Permalink
Provide some debug output upon spec filtering
Browse files Browse the repository at this point in the history
This might be usefull in debugging issues such as #1181 [1], where user
error and terminal unfamiliarity is the actual root cause.

[1] #1181
  • Loading branch information
badeball committed Jun 24, 2024
1 parent bf8fcff commit fb421ae
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/add-cucumber-preprocessor-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import fs from "fs";

import { inspect } from "node:util";

import { IdGenerator, SourceMediaType } from "@cucumber/messages";

import parse from "@cucumber/tag-expressions";
Expand Down Expand Up @@ -47,6 +49,8 @@ import { memoize } from "./helpers/memoize";

import { assertNever } from "./helpers/assertions";

import debug from "./helpers/debug";

const resolve = memoize(origResolve);

export type AddOptions = {
Expand Down Expand Up @@ -133,6 +137,8 @@ export async function addCucumberPreprocessorPlugin(
const tags = getTags(config.env);

if (tags !== null && preprocessor.filterSpecs) {
debug(`Filtering specs using expression ${inspect(tags)}`);

const node = parse(tags);

const testFiles = getTestFiles(
Expand Down Expand Up @@ -176,6 +182,8 @@ export async function addCucumberPreprocessorPlugin(
);
});

debug(`Resolved specs ${inspect(testFiles)}`);

const propertyName = "specPattern" in config ? "specPattern" : "testFiles";

/**
Expand Down

0 comments on commit fb421ae

Please sign in to comment.