Scripts: Default Playwright config file doesn't work #55419
Labels
Needs Testing
Needs further testing to be confirmed.
[Status] In Progress
Tracking issues with work in progress
[Tool] WP Scripts
/packages/scripts
[Type] Bug
An existing feature does not function as intended
In #53108, wp-scripts now supports Playwright. However, when using the
@wordpress/scripts
package alone, I encountered a problem where the config file was not loaded correctly or a custom setup was required.npm init
npm install @wordpress/scripts
package.json:
At this point I would expect Playwright's default configuration to be referenced and the tests to be run. This is because the handbook states:
However, when I run
npm run test
, I get the following error:Therefore, create a
playwright.config.ts
file and explicitly set the default configuration of the@wordpress/scripts
package as appropriate:This time, the following error occurs:
In the end, I was able to get it to work correctly by specifying my own setup file in the
globalSetup
property as shown below.I think it would be better to provide a proper global setup so that the
wp-scripts test-playwright
command works properly even when the@wordpress/scripts
package is used in a project that does not have a config file.The text was updated successfully, but these errors were encountered: