-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Closed
Description
Context:
- Playwright Version: 1.20.1 (also tried beta)
- Node.js version: 16
Code Snippet
import { test } from '@playwright/test'
import getport from 'get-port'
test.describe('suite', () => {
test('test', async ({ page }) => {
console.log(await getport())
await page.goto('https://playwright.dev')
})
})Describe the bug
Playwright fails with no test found error due to import import getport from 'get-port' of a module.
PW_EXPERIMENTAL_TS_ESM=1 doesn't help anyhow in any combination with or without "type": "module" in the package.json
Error [ERR_REQUIRE_ESM]: require() of ES Module browser-tests/node_modules/get-port/index.js from browser-tests/test/test.spec.ts not supported.
Instead change the require of index.js in browser-tests/test/test.spec.ts to a dynamic import() which is available in all CommonJS modules.
Strajk and EgorovArtem34
Metadata
Metadata
Assignees
Labels
No labels