Skip to content

Commit 6e97070

Browse files
committed
Fail loudly on SDK auth errors in e2e tests
1 parent 2076770 commit 6e97070

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

sdk/e2e/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ describe('E2E: My Test', () => {
122122
handleEvent: collector.handleEvent,
123123
})
124124

125-
if (isAuthError(result.output)) return
125+
assertNoAuthError(result.output)
126126

127127
expect(result.output.type).not.toBe('error')
128128
}, DEFAULT_TIMEOUT)

sdk/e2e/utils/get-api-key.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,12 @@ export function isNetworkError(output: {
8080
const msg = output.message?.toLowerCase() ?? ''
8181
return output.errorCode === 'NETWORK_ERROR' || msg.includes('network error')
8282
}
83+
84+
/**
85+
* Throw when an auth error is encountered so tests fail loudly.
86+
*/
87+
export function assertNoAuthError(output: { type: string; message?: string }): void {
88+
if (isAuthError(output)) {
89+
throw new Error(`Unexpected auth error during e2e: ${output.message || 'unknown error'}`)
90+
}
91+
}

0 commit comments

Comments
 (0)