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

Add 'src' folder to Jest roots #167

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

itsananderson
Copy link
Member

I was poking at the Jest CLI trying to get it to just run related tests when I change source files, but it was failing to find related tests.

According to this, the reason Jest can't find related tests is because the src folder isn't in the roots list in the Jest config.

This PR updates the roots config to include the src folder.

Before:

> yarn jest --findRelatedTests src/api-review-state.ts
yarn run v1.22.22
$ C:\Users\itsananderson\src\cation\node_modules\.bin\jest --findRelatedTests src/api-review-state.ts
No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In C:\Users\itsananderson\src\cation
  47 files checked.
  testMatch:  - 0 matches
  testPathIgnorePatterns: spec\\utils.ts - 46 matches
  testRegex: (\\spec\\.*|(\.|\\)(test|spec))\.tsx?$ - 6 matches
Pattern: src\\api-review-state.ts - 0 matches
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

After:

> yarn jest --findRelatedTests src/api-review-state.ts

... snip ...

Test Suites: 2 passed, 2 total
Tests:       35 passed, 35 total
Snapshots:   0 total
Time:        19.175 s, estimated 20 s
Ran all test suites related to files matching /src\\api-review-state.ts/i.
Done in 19.82s.

@itsananderson itsananderson requested review from a team as code owners September 20, 2024 18:06
@codebytere codebytere merged commit bb2bb6e into electron:main Sep 23, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants