Skip to content

Commit

Permalink
Add more tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
onurtemizkan committed Mar 24, 2024
1 parent d9146cb commit c671e1f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Expand Up @@ -43,6 +43,14 @@ const init = async () => {
},
});

server.route({
method: 'GET',
path: '/promise-error',
handler: async (_request, _h) => {
return Promise.reject(new Error('Sentry Test Error'));
},
});

await Sentry.setupHapiErrorHandler(server);
await server.start();

Expand Down
Expand Up @@ -58,4 +58,12 @@ describe('hapi auto-instrumentation', () => {
.start(done)
.makeRequest('get', '/boom-error');
});

test('CJS - should handle promise rejections in routes.', done => {
createRunner(__dirname, 'scenario.js')
.expect({ event: EXPECTED_ERROR_EVENT })
.expectError()
.start(done)
.makeRequest('get', '/promise-error');
});
});

0 comments on commit c671e1f

Please sign in to comment.