Skip to content

Commit

Permalink
fix(node): Improve logging in express scope tag match test (#5977)
Browse files Browse the repository at this point in the history
This adds logging of the received and expected values when the tags in the express scope separation test don't match, for easier debugging.
  • Loading branch information
lobsterkatie committed Oct 17, 2022
1 parent 0596b6f commit 539d648
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/node/test/manual/express-scope-separation/start.js
Expand Up @@ -11,6 +11,8 @@ global.console.error = () => null;
function assertTags(actual, expected) {
if (JSON.stringify(actual) !== JSON.stringify(expected)) {
console.log(colorize('FAILED: Scope contains incorrect tags\n', 'red'));
console.log(colorize(`Got: ${JSON.stringify(actual)}\n`, 'red'));
console.log(colorize(`Expected: ${JSON.stringify(expected)}\n`, 'red'));
process.exit(1);
}
}
Expand Down
4 changes: 4 additions & 0 deletions packages/node/test/manual/webpack-domain/index.js
Expand Up @@ -26,12 +26,16 @@ Sentry.init({
if (event.message === 'inside') {
if (event.tags.a !== 'x' && event.tags.b !== 'c') {
console.log(colorize('FAILED: Scope contains incorrect tags\n', 'red'));
console.log(colorize(`Got: ${JSON.stringify(event.tags)}\n`, 'red'));
console.log(colorize(`Expected: Object including { a: 'x', b: 'c' }\n`, 'red'));
process.exit(1);
}
}
if (event.message === 'outside') {
if (event.tags.a !== 'b') {
console.log(colorize('FAILED: Scope contains incorrect tags\n', 'red'));
console.log(colorize(`Got: ${JSON.stringify(event.tags)}\n`, 'red'));
console.log(colorize(`Expected: Object including { a: 'b' }\n`, 'red'));
process.exit(1);
}
}
Expand Down

0 comments on commit 539d648

Please sign in to comment.