Skip to content

@nx/playwright - Generators

The @nx/playwright plugin provides various generators to help you create and configure playwright projects within your Nx workspace. Below is a complete reference for all available generators and their options.

For an overview of the plugin and setup instructions, see the @nx/playwright introduction.

Add a Playwright configuration.

Usage:

Terminal window
nx generate @nx/playwright:configuration [options]
OptionTypeDescriptionDefault
--projectstring [required]The project to add a Playwright configuration to.
--directorystringA directory where the project is placed relative from the project root."e2e"
--enableTypedLintingbooleanWhether to enable typed linting. For flat configs, this configures the recommended parserOptions.projectService and tsconfigRootDir. For legacy .eslintrc configs, this configures parserOptions.project. We do not enable this by default for lint performance reasons.false
--jsbooleanGenerate JavaScript files rather than TypeScript files.false
--linterstringThe tool to use for running lint checks.
--rootProjectbooleanCreate a application at the root of the workspacefalse
--setParserOptionsProjectbooleanDeprecated alias for enableTypedLinting.false
--skipFormatbooleanSkip formatting files.false
--skipInstallbooleanSkip running playwright install. This is to ensure that playwright browsers are installed.false
--skipPackageJsonbooleanDo not add dependencies to package.json.false
--webServerAddressstringThe address of the web server.
--webServerCommandstringThe command to start the web server.

Convert existing Playwright project(s) using @nx/playwright:playwright executor to use @nx/playwright/plugin. Defaults to migrating all projects. Pass ‘—project’ to migrate only one target.

Usage:

Terminal window
nx generate @nx/playwright:convert-to-inferred [options]
OptionTypeDescriptionDefault
--projectstringThe project to convert from using the @nx/playwright:playwright executor to use @nx/playwright/plugin.
--skipFormatbooleanWhether to format files at the end of the migration.false

You can get help for any generator by adding the --help flag:

Terminal window
nx generate @nx/playwright:<generator> --help