Skip to content

Commit

Permalink
Merge branch 'main' into cleanup-instrumentations
Browse files Browse the repository at this point in the history
  • Loading branch information
vmarchaud authored Oct 27, 2021
2 parents 21cb795 + c0ab952 commit 1e19790
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
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
);
}
});
});
});
});

0 comments on commit 1e19790

Please sign in to comment.