Skip to content
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]: Change testDir in the Playwright config to accept an array of paths #32805

Open
alex-vukov opened this issue Sep 25, 2024 · 3 comments

Comments

@alex-vukov
Copy link

🚀 Feature Request

Currently the testDir parameter in the playwright config file accepts a single path string (https://playwright.dev/docs/api/class-testconfig#test-config-test-dir). Making it an array will be of great benefit for use cases such as monorepos etc.

Example

Before:

export default defineConfig({
  testDir: './tests',
});

After:

export default defineConfig({
  testDir: ['dirA/tests', 'dirB/tests', 'dirC/tests'],
});

Motivation

In a monorepo setup where different parts of the application have their own test directories this will make it possible to run all tests at once when needed. At the moment it's not possible and a separate Playwright instance must be started for each sub-repo.

@yury-s
Copy link
Member

yury-s commented Sep 25, 2024

As a workaround, you can set a common parent as testDir and then use testMatch with multiple entries to specify actual paths that should be included.

One issue with having multiple entries in testDir is to which one to use when computing relative path of a test in the test reports.

@alex-vukov
Copy link
Author

Do you have any idea how I can make testMatch stop ignoring node_modules? I have a weird use case when I have to run tests from an npm package

@yury-s
Copy link
Member

yury-s commented Sep 27, 2024

No easy solution at the moment, node_modules problem is tracked in #14303

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants