Skip to content

feat: add runtime hooks for API request and response handling #381

feat: add runtime hooks for API request and response handling

feat: add runtime hooks for API request and response handling #381

Triggered via pull request November 6, 2024 19:55
Status Failure
Total duration 43s
Artifacts

ci.yml

on: pull_request
Fit to window
Zoom out
Zoom in

Annotations

8 errors
typecheck: dist/runtime/server/$api.ts#L6
Module '"#imports"' has no exported member 'useNitroApp'.
typecheck: dist/runtime/server/handler.ts#L15
Module '"#imports"' has no exported member 'useNitroApp'.
typecheck: src/runtime/server/handler.ts#L15
Module '"#imports"' has no exported member 'useNitroApp'.
typecheck
Process completed with exit code 2.
test/e2e.test.ts > nuxt-api-party > fetches data with $testApi: test/e2e.test.ts#L13
FetchError: [GET] "http://127.0.0.1:43301/$testApi": 500 Internal Server Error ❯ $fetchRaw2 node_modules/.pnpm/[email protected]/node_modules/ofetch/dist/shared/ofetch.03887fc3.mjs:311:14 ❯ $fetch2 node_modules/.pnpm/[email protected]/node_modules/ofetch/dist/shared/ofetch.03887fc3.mjs:316:15 ❯ test/e2e.test.ts:13:18 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { request: 'http://127.0.0.1:43301/$testApi', options: { headers: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, retry: +0 }, response: { _data: { url: '/$testApi', statusCode: 500, statusMessage: '', message: 'hook is not a function', stack: '' }, constructor: 'Function<Response>', type: 'basic', url: 'http://127.0.0.1:43301/$testApi', redirected: false, status: 500, ok: false, statusText: 'Internal Server Error', headers: { constructor: 'Function<Headers>', append: 'Function<append>', delete: 'Function<delete>', get: 'Function<get>', has: 'Function<has>', set: 'Function<set>', getSetCookie: 'Function<getSetCookie>', keys: 'Function<keys>', values: 'Function<values>', entries: 'Function<entries>', forEach: 'Function<forEach>' }, body: { constructor: 'Function<ReadableStream>', locked: true, cancel: 'Function<cancel>', getReader: 'Function<getReader>', pipeThrough: 'Function<pipeThrough>', pipeTo: 'Function<pipeTo>', tee: 'Function<tee>', values: 'Function<values>' }, bodyUsed: true, clone: 'Function<clone>', blob: 'Function<blob>', arrayBuffer: 'Function<arrayBuffer>', text: 'Function<text>', json: 'Function<json>', formData: 'Function<formData>', bytes: 'Function<bytes>' }, data: { url: '/$testApi', statusCode: 500, statusMessage: '', message: 'hook is not a function', stack: '' }, status: 500, statusCode: 500, statusText: 'Internal Server Error', statusMessage: 'Internal Server Error' }
test/e2e.test.ts > nuxt-api-party > throws error for invalid response with $testApi: test/e2e.test.ts#L19
Error: Snapshot `nuxt-api-party > throws error for invalid response with $testApi 1` mismatched - Expected + Received - { - "data": { - "reason": "anything", - }, - "message": "Not Found", - "stack": "", - "statusCode": 404, - "statusMessage": "Not Found", - "url": "/api/foo/bar", - } + undefined ❯ test/e2e.test.ts:19:33
test/e2e.test.ts > nuxt-api-party > fetches data with useTestApiData: test/e2e.test.ts#L24
Error: Snapshot `nuxt-api-party > fetches data with useTestApiData 1` mismatched - Expected + Received - [ - { - "completed": false, - "id": 1, - "isTransformed": true, - "title": "delectus aut autem", - "userId": 1, - }, - { - "completed": false, - "id": 2, - "isTransformed": true, - "title": "quis ut nam facilis et officia qui", - "userId": 1, - }, - { - "completed": false, - "id": 3, - "isTransformed": true, - "title": "fugiat veniam minus", - "userId": 1, - }, - ] + null ❯ test/e2e.test.ts:24:33
test
Process completed with exit code 1.