Replies: 3 comments 1 reply
-
Hey there, @alexcroox! I'm here to assist you with any bugs, questions, or contributions you have. Let's dive in and see how I can help you out! The error you're encountering is due to the import { fileURLToPath } from 'node:url'
import { $fetch, setup } from '@nuxt/test-utils/e2e'
import { describe, expect, it } from 'vitest'
await setup({
rootDir: fileURLToPath(new URL('../', import.meta.url)),
dev: true,
})
describe('signed-url.post', () => {
it('should return signed upload url', async () => {
const response = await $fetch('/api/file/v1/signed-url', {
method: 'POST',
body: JSON.stringify({
category: 'profile',
name: 'test.jpg',
sizeBytes: 1000,
mimeType: 'image/jpeg'
})
})
// Add your assertions here
})
}) Make sure to place the |
Beta Was this translation helpful? Give feedback.
-
@alexcroox Were you able to get this working? I'm stuck with this same issue and nothing has worked so far. |
Beta Was this translation helpful? Give feedback.
-
Afraid not, I gave up trying to unit test the server side of Nuxt a while ago :( |
Beta Was this translation helpful? Give feedback.
-
I have the following Nuxt 3 server api test, sat alongside the endpoint file:
and the following vitest config:
The
beforeAll
part of the test never completes and errors after about 20 seconds with:I can't work out why this is triggering the error:
Beta Was this translation helpful? Give feedback.
All reactions