Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/opentelemetry-core/src/utils/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function urlMatches(url: string, urlToMatch: string | RegExp): boolean {
if (typeof urlToMatch === 'string') {
return url === urlToMatch;
} else {
return urlToMatch.test(url);
return !!url.match(urlToMatch);
}
}
/**
Expand Down
13 changes: 13 additions & 0 deletions packages/opentelemetry-core/test/utils/url.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,18 @@ describe('Core - Utils - url', () => {
);
});
});
describe('when regex has global flag', () => {
it('should return true', () => {
const ignoredUrls = [/myaddr/g];
// Run test multiple times to ensure same result (git.io/JimS1)
for (let i = 0; i < 3; i++) {
assert.strictEqual(
isUrlIgnored(urlToTest, ignoredUrls),
true,
urlIgnored
);
}
});
});
});
});