Closed
Description
Reproduction steps
- Create a Playwright test.
import { createTestHttpServer } from '@epic-web/test-server/http'
import { test, expect } from '../playwright.extend'
test('', () => {
createTestHttpServer()
})
- Run the text via
npx playwright test
. - See the following error:
Error: require() of ES Module /node_modules/.pnpm/@[email protected]/node_modules/@epic-web/test-server/lib/http.js from /test/browser/sse-api/sse.server.connect.test.ts not supported.
Instead change the require of http.js in /test/browser/sse-api/sse.server.connect.test.ts to a dynamic import() which is available in all CommonJS modules.
Expected behavior
There must be no error, the test should compile and run.
Context
The error is a bit odd because the package is ESM, and there's no require()
statements. I suspect what's happening is Playwright transpiles the ESM test to CJS, and because the imported package is ESM-only, it fails?
Metadata
Metadata
Assignees
Labels
No labels