Skip to content

Commit

Permalink
Ignore no requests if ignoreSuffix is empty (#94)
Browse files Browse the repository at this point in the history
An empty ignore suffix currently causes all requests to be ignored. This makes it impossible to disable ignoring by suffix.
  • Loading branch information
michaelzangl authored Oct 7, 2022
1 parent 7232663 commit f838ffc
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/config/AgentConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,19 @@ export function finalizeConfig(config: AgentConfig): void {
'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
Expand Down

0 comments on commit f838ffc

Please sign in to comment.