Files
msw/test/browser/msw-api/setup-worker/start/warn-on-wait-until-ready.test.ts

19 lines
780 B
TypeScript

import { test, expect } from '../../../playwright.extend'
import { waitFor } from '../../../../support/waitFor'
test('warns on the "waitUntilReady" option in "worker.start()"', async ({
loadExample,
spyOnConsole,
}) => {
const consoleSpy = spyOnConsole()
await loadExample(
new URL('./warn-on-wait-until-ready.mocks.ts', import.meta.url),
)
await waitFor(() => {
expect(consoleSpy.get('warning')).toEqual([
`[MSW] The "waitUntilReady" option has been deprecated. Please remove it from this "worker.start()" call. Follow the recommended Browser integration (https://mswjs.io/docs/integrations/browser) to eliminate any race conditions between the Service Worker registration and any requests made by your application on initial render.`,
])
})
})