-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Allow tests to be written in typescript with "type": "module"
in the absence of a config file
#28534
Comments
@lilnasy Unfortunately, Playwright is not going to support this in the near future. To work with typescript and |
Could there be an explicit opt-in, similar to node's I personally don't mind the cli flag being long and I could try to implement it if the team is receptive to the idea. |
"type": "module"
in the absence of a config file
Thanks for the pointer! After looking around the codebase, I got it working with this script: "scripts": {
- "test": "playwright test"
+ "test": "node --no-warnings --experimental-loader playwright/lib/transform/esmLoader node_modules/playwright/cli.js test"
}, |
This might be fixed in v1.43. |
Yes, it has! Thanks @mxschmitt for implementing ts loader on top of newer node APIs and the shout. Thanks @dgozman for flipping the switch. |
In the process of moving from
vitest
to@playwright/test
, I kept running into this issue:After browsing around and finding #27827 and #23662 to no help, I realised it was because I did not have playwright.config in my project. I do not want to change any defaults and I certainly don't want another root-level config if I can avoid it.
To reproduce, run
npm init playwright
with all default options, then remove playwright.config file and add"type": "module"
to thepackage.json
.The text was updated successfully, but these errors were encountered: