File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
dev-packages/node-integration-tests/suites/fastify/deprecation Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ import { loggingTransport } from '@sentry-internal/node-integration-tests' ;
2+ import * as Sentry from '@sentry/node' ;
3+
4+ Sentry . init ( {
5+ dsn :
'https://[email protected] /1337' , 6+ release : '1.0' ,
7+ transport : loggingTransport ,
8+ } ) ;
9+
10+ import { startFastifyServerAndSendPortToRunner } from '@sentry-internal/node-integration-tests' ;
11+ import Fastify from 'fastify' ;
12+
13+ const app = Fastify ( ) ;
14+
15+ app . get ( '/test/deprecated' , ( _req , res ) => {
16+ res . send ( { } ) ;
17+ } ) ;
18+
19+ Sentry . setupFastifyErrorHandler ( app ) ;
20+
21+ startFastifyServerAndSendPortToRunner ( app ) ;
Original file line number Diff line number Diff line change 1+ import { AxiosError } from 'axios' ;
2+ import { cleanupChildProcesses , createRunner } from '../../../utils/runner' ;
3+
4+ afterAll ( ( ) => {
5+ cleanupChildProcesses ( ) ;
6+ } ) ;
7+
8+ test ( 'suppress fastify deprecation warning when `routerPath` property is accessed' , async ( ) => {
9+ // ensures that the assertions in the catch block are called
10+ expect . assertions ( 3 ) ;
11+
12+ const runner = createRunner ( __dirname , 'server.ts' ) . start ( ) ;
13+
14+ try {
15+ // Axios from `makeRequest` will throw 404.
16+ await runner . makeRequest ( 'get' , '/test/deprecated/does-not-exist' ) ;
17+ } catch ( error : any ) {
18+ expect ( error ) . toBeInstanceOf ( AxiosError ) ;
19+ expect ( error . message ) . toBe ( 'Request failed with status code 404' ) ;
20+ expect ( error . response . status ) . toBe ( 404 ) ;
21+ }
22+ } ) ;
You can’t perform that action at this time.
0 commit comments