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

jest runs all tests found in monorepo [email protected] #4410

Closed
bugzpodder opened this issue May 4, 2018 · 4 comments
Closed

jest runs all tests found in monorepo [email protected] #4410

bugzpodder opened this issue May 4, 2018 · 4 comments
Milestone

Comments

@bugzpodder
Copy link

bugzpodder commented May 4, 2018

Jest currently runs all tests it can find in every workspace in the monorepo (spec/tests) when ran from CRA workspace.
This is somewhat unexpected, and can be problematic:

  • jest version mismatches can break tests
  • jest snapshots can potentially record different things depending on configuration

If needed I can try to get a clean repro up.

@bugzpodder bugzpodder changed the title jest runs all tests found in mono-repro [email protected] jest runs all tests found in monorepo [email protected] May 4, 2018
@bugzpodder
Copy link
Author

It has some really weird effects, such as if you have a cypress directory for e2e under the CRA app directory, jest would skip them but if you have a cypress directory in a imported workspace, jest would happily decide to run it and fail.

@bugzpodder
Copy link
Author

This is likely related to #3967

@bradfordlemley
Copy link
Contributor

@bugzpodder The current 2.0 implementation assumes that you want all workspaces in the monorepo to be treated as part of your app source (transpiled, linted, and tested), there is no way to opt in or out. #4092 proposes to fix this by requiring workspaces to be opted in.

It's not clear if that would fix your use cases, though. (e.g, Are you wanting to transpile the other workspaces, but not run their tests?) What do you think?

(BTW, as a workaround for the current issue, you should be able to give a pattern to the test command, e.g. react-scripts test myapp to avoid running tests from other workspaces.)

@SavePointSam
Copy link

SavePointSam commented Jun 5, 2018

Thanks for the quick scoping fix! Though I totally agree there should be a better way to go about this before 2.0.

EDIT: scoping isn't a great long-term solution as hitting a during the test suite will revert to all tests in the monorepo.

@Timer Timer closed this as completed Sep 26, 2018
@lock lock bot locked and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants