Ignore no requests if ignoreSuffix is empty (#94)
An empty ignore suffix currently causes all requests to be ignored. This makes it impossible to disable ignoring by suffix.
diff --git a/src/config/AgentConfig.ts b/src/config/AgentConfig.ts
index 8394a61..bda72f2 100644
--- a/src/config/AgentConfig.ts
+++ b/src/config/AgentConfig.ts
@@ -53,10 +53,19 @@
'i',
);
- const ignoreSuffix = `^.+(?:${config
- .ignoreSuffix!.split(',')
- .map((s) => escapeRegExp(s.trim()))
- .join('|')})$`;
+ const convertIgnoreSuffix = (configuredIgnoreSuffix: string | undefined) => {
+ if (!configuredIgnoreSuffix) {
+ // This regexp will never match => no files are ignored.
+ return '\\A(?!x)x';
+ } else {
+ return `^.+(?:${configuredIgnoreSuffix!
+ .split(',')
+ .map((s) => escapeRegExp(s.trim()))
+ .join('|')})$`;
+ }
+ };
+
+ const ignoreSuffix = convertIgnoreSuffix(config.ignoreSuffix);
const ignorePath =
'^(?:' +
config