Skip to content

Commit

Permalink
feat(playwright-test): scan the world (#6935)
Browse files Browse the repository at this point in the history
Running `npx playwright test` results in a cryptic error message that says to check `--help` for more information.

I started to rewrite it, but I think instead it would be much nicer if we just treated `npx playwright test` as an alias for `npx playwright test -c .`. There is a comment in the code that worries this will be slow because it will scan the world. However we need to support this case anyway for the tests-next-to-code pattern.

It looks like this should be fast because we ignore node_modules/.gitignore entries. If this is still too slow we should make it faster. If we can't make it faster we should throw a more specific error telling the user how to make it faster.
  • Loading branch information
JoelEinbinder authored Jun 8, 2021
1 parent 53d68bd commit 93f6b57
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/test/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ async function runTests(args: string[], opts: { [key: string]: any }) {
}
} else if (!loadConfig(path.resolve(process.cwd(), tsConfig)) && !loadConfig(path.resolve(process.cwd(), jsConfig))) {
// No --config option, let's look for the config file in the current directory.
// If not, do not assume that current directory is a root testing directory, to avoid scanning the world.
throw new Error(`Configuration file not found. Run "npx playwright test --help" for more information.`);
// If not, scan the world.
runner.loadEmptyConfig(process.cwd());
}

const result = await runner.run(!!opts.list, args.map(forceRegExp), opts.project || undefined);
Expand Down

0 comments on commit 93f6b57

Please sign in to comment.