Leo
Leo
Explore posts from servers
NNuxt
Created by Leo on 12/8/2024 in #❓・help
/app/.nuxt/dev/index.mjs failed
Hello, I receive the following error after the Vite server has warmed up:
ERROR [worker reload] [worker init] /app/.nuxt/dev/index.mjs failed
ERROR [worker reload] [worker init] /app/.nuxt/dev/index.mjs failed
I receive this error, since I migrated my project from Bun to pnpm. I've already deleted .nuxt and node_modules
10 replies
NNuxt
Created by Leo on 11/24/2024 in #❓・help
Vitest not running in Docker Container.
Hey, I'm trying to run my tests inside a Docker Container using a Github action. If I try to run it outside of it, everything works fine, but if I run it inside a container, it is stuck at the point where the console logs:
RUN v2.1.5 /__w/daytistics/daytistics/frontend
RUN v2.1.5 /__w/daytistics/daytistics/frontend
5 replies
NNuxt
Created by Leo on 11/17/2024 in #❓・help
Vitest times out when mocking the Router
Hey, I'm currently trying to mock useRouter().push(), but unfortunately, Vitest (the mountSuspended function) times out.
// Some stuff
const mockRouterPush = vi.fn();

mockNuxtImport('useRouter', () => {
return () => ({
push: mockRouterPush,
});
});

describe('CreateDaytisticContent', () => {
beforeEach(() => {
vi.clearAllMocks();
// Setup successful API response
mockCreateDaytistic.mockResolvedValue({
status: 201,
_data: { id: '123' },
});
});

it('submits form successfully when date is selected', async () => {
const wrapper = await mountSuspended(CreateDaytisticContent);
const testDate = new Date('2024-01-01');

// First, set the modelValue prop
await wrapper.findComponent(DatePicker).setValue(testDate);

// Then emit the update event
await wrapper.findComponent(DatePicker).vm.$emit('update', testDate);

// Wait for Vue to process the updates
await wrapper.vm.$nextTick();

// Trigger form submission
await wrapper.find('form').trigger('submit');

// Wait for all promises to resolve
await flushPromises();

// Verify API call was made with correct date
expect(mockCreateDaytistic).toHaveBeenCalledWith(testDate);

// Verify success flow
expect(mockRouterPush).toHaveBeenCalled();
expect(mockSuccess).toHaveBeenCalled();
});


});
// Some stuff
const mockRouterPush = vi.fn();

mockNuxtImport('useRouter', () => {
return () => ({
push: mockRouterPush,
});
});

describe('CreateDaytisticContent', () => {
beforeEach(() => {
vi.clearAllMocks();
// Setup successful API response
mockCreateDaytistic.mockResolvedValue({
status: 201,
_data: { id: '123' },
});
});

it('submits form successfully when date is selected', async () => {
const wrapper = await mountSuspended(CreateDaytisticContent);
const testDate = new Date('2024-01-01');

// First, set the modelValue prop
await wrapper.findComponent(DatePicker).setValue(testDate);

// Then emit the update event
await wrapper.findComponent(DatePicker).vm.$emit('update', testDate);

// Wait for Vue to process the updates
await wrapper.vm.$nextTick();

// Trigger form submission
await wrapper.find('form').trigger('submit');

// Wait for all promises to resolve
await flushPromises();

// Verify API call was made with correct date
expect(mockCreateDaytistic).toHaveBeenCalledWith(testDate);

// Verify success flow
expect(mockRouterPush).toHaveBeenCalled();
expect(mockSuccess).toHaveBeenCalled();
});


});
5 replies
NNuxt
Created by Leo on 11/10/2024 in #❓・help
Internal server error: Attempted to assign to readonly property.
No description
5 replies
NNuxt
Created by Leo on 10/30/2024 in #❓・help
No Cookies sent in Header?
Hello everyone, does anyone have any idea why no cookies are sent when a request is made via the plugin? It doesn't work in the ssr or the spa. https://paste.gg/p/anonymous/c723ccf5af994f65a376dc56c2909d08 Thank you in advance!
13 replies