-
Notifications
You must be signed in to change notification settings - Fork 333
feat: make config.testPattern optional #362
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
| const runner = new TestRunner(process.cwd(), config); | ||
| await runner.initialize(); | ||
| const success = await runner.runTests(testPattern); | ||
| const success = await runner.execute(config.testPattern); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name better represents what the function does (at the time of calling, is not known yet if there are any tests to be executed yet).
| if (files.length === 0) { | ||
| this.reporter.error( | ||
| "Test Discovery", | ||
| `No test files found matching: ${testPattern}`, | ||
| ); | ||
| this.log.error("No test files found matching", { | ||
| pattern: testPattern, | ||
| }); | ||
| process.exit(1); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is duplicated started on line 375 below.
|
|
||
| private async findTestFiles(pattern?: string): Promise<string[]> { | ||
| this.log.trace("Finding test files", { pattern }); | ||
| const testPattern = pattern || this.config.testPattern || "**/*.test.ts"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Config should be the source of truth of all default values, in conjuction with Zod validation.
| this.browserManager = new BrowserManager(this.config); | ||
| } | ||
|
|
||
| private async findTestFiles(pattern?: string): Promise<string[]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once the default value assignment and duplicated logic are removed, there isn't much value having this function.
| describe("Config parsing", () => { | ||
| let baseConfig: ShortestConfig; | ||
|
|
||
| beforeEach(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved below (not used by with minimal config test)
config.testPatternoptional, default to**/*.test.tsWhy