Skip to content

Commit 5a51b06

Browse files
nicohrubecclaude
andcommitted
test(node): Make logs-disabled test deterministically catch leaks
Flush the log buffer before capturing the sentinel error so a leaked log envelope arrives first and fails the ordered `event` expectation. Previously the error was sent first and the runner could complete before a stray log arrived, letting a broken disable path pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 4ae267a commit 5a51b06

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

  • dev-packages/node-integration-tests/suites/public-api/logs-disabled

‎dev-packages/node-integration-tests/suites/public-api/logs-disabled/subject.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ scope.setClient(client);
1414
client.init();
1515

1616
async function run(): Promise<void> {
17-
// Should be dropped because logs are disabled.
1817
Sentry.logger.info('this log should not be captured', {}, { scope });
1918

20-
// Should be delivered — used as a sentinel so the test has a deterministic
21-
// envelope to match instead of asserting on the absence of one.
19+
// Flush the log buffer before the sentinel is captured. If the disable path is
20+
// broken, the leaked log envelope is sent here and arrives before the error,
21+
// failing the ordered `event` expectation. If logs are correctly disabled,
22+
// the buffer is empty and only the sentinel error is delivered.
23+
await client.flush();
24+
2225
scope.captureException(new Error('sentinel_error'));
2326

2427
await client.flush();

0 commit comments

Comments
 (0)