Skip to content

Commit

Permalink
Improve debug logging for IgnoreList (#13814)
Browse files Browse the repository at this point in the history
  • Loading branch information
paleite committed Oct 6, 2021
1 parent 42c9eda commit 7acc68a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/babel-core/src/config/config-chain.ts
Expand Up @@ -779,6 +779,20 @@ function configFieldIsApplicable(
return matchesPatterns(context, patterns, dirname);
}

/**
* Print the ignoreList-values in a more helpful way than the default.
*/
function ignoreListReplacer(
_key: string,
value: IgnoreList | IgnoreItem,
): IgnoreList | IgnoreItem | string {
if (value instanceof RegExp) {
return String(value);
}

return value;
}

/**
* Tests if a filename should be ignored based on "ignore" and "only" options.
*/
Expand All @@ -793,6 +807,7 @@ function shouldIgnore(
context.filename ?? "(unknown)"
}" because it matches one of \`ignore: ${JSON.stringify(
ignore,
ignoreListReplacer,
)}\` from "${dirname}"`;
debug(message);
if (context.showConfig) {
Expand All @@ -806,6 +821,7 @@ function shouldIgnore(
context.filename ?? "(unknown)"
}" because it fails to match one of \`only: ${JSON.stringify(
only,
ignoreListReplacer,
)}\` from "${dirname}"`;
debug(message);
if (context.showConfig) {
Expand Down

0 comments on commit 7acc68a

Please sign in to comment.