ericmatthys.
ericmatthys.
CDCloudflare Developers
Created by ericmatthys. on 5/30/2024 in #pages-help
wrangler.toml configuration beta in a monorepo
Yes setting the Root directory fixes it!
4 replies
CDCloudflare Developers
Created by ericmatthys. on 7/22/2024 in #vitest-integration-beta
Is there any way to reset mocks with
// @ts-expect-error
import { resetMockAgent } from 'cloudflare:mock-agent';
import { fetchMock } from 'cloudflare:test';
import { afterEach, beforeEach } from 'vitest';

beforeEach(() => {
fetchMock.activate();
fetchMock.disableNetConnect();
});

afterEach(() => {
fetchMock.assertNoPendingInterceptors();
resetMockAgent(fetchMock);
});
// @ts-expect-error
import { resetMockAgent } from 'cloudflare:mock-agent';
import { fetchMock } from 'cloudflare:test';
import { afterEach, beforeEach } from 'vitest';

beforeEach(() => {
fetchMock.activate();
fetchMock.disableNetConnect();
});

afterEach(() => {
fetchMock.assertNoPendingInterceptors();
resetMockAgent(fetchMock);
});
4 replies
CDCloudflare Developers
Created by ericmatthys. on 7/22/2024 in #vitest-integration-beta
Is there any way to reset mocks with
Follow up to ^^ is there any way to import resetMockAgent without a TS import error?
4 replies
CDCloudflare Developers
Created by ericmatthys. on 7/22/2024 in #vitest-integration-beta
Is there any way to reset mocks with
import { resetMockAgent } from 'cloudflare:mock-agent'; seems to be what I am looking for...
4 replies
CDCloudflare Developers
Created by ericmatthys. on 7/22/2024 in #vitest-integration-beta
Is there any way to reset mocks with
Basically, mocks set up within a nested describe can affect other describes in the test file.
4 replies