-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Configure Jest with Stack and Fiber as separate projects #10214
Conversation
"<rootDir>/src", | ||
"node_modules/fbjs" | ||
], | ||
"collectCoverageFrom": [ |
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.
i think this one should go to package.json, since it's shared between both projects. (both projects share reporters, including CoverageReporter
that uses this information)
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.
I do that, then this is no longer a complete project file on its own though, right?
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.
right. with this option you should be able to collect coverage when running this project separately, but i don't think it'll collect coverage properly when running with MPR (specifically i don't think it'll add files that have 0% coverage to the report).
"<rootDir>/src", | ||
"node_modules/fbjs" | ||
], | ||
"collectCoverageFrom": [ |
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.
same as in fiber.config.json
The only issue is that when you run both right now there's no way to see which one failed. jestjs/jest#4065 I think that's fine for now since we're expecting to delete one but that'll be a blocker for long term usage. |
}); | ||
}); | ||
|
||
// Error logging varies between Fiber and Stack; |
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.
How does it vary? Do we leave this after deleting Stack, or do we change something?
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 just copied from setupMocks. I don't know exactly why. It seems to me that what it solves is silencing console.error
in some case.
This disables the comparison against previously recorded test. Instead, we'll rely on jest failures to fail tests.
Allows us to run both in the same jest run. The setupMocks file is forked into specific environment configuration for each project. This replaces the environment variable. I used copy pasta here to make it clear. We can abstract this later. It's clear to me that simply extracting shared stuff is not the best way to abstract this. setupMocks for example didn't need all the code in both branches. I think that some of the stuff that is shared such as error message extracting etc. should probably be lifted out into a stand-alone jest project instead of being shared.
There's a behavior change when projects are used which makes setupTestFrameworkScriptFile not override the normal config. This test should probably just move to a separate CI script or something less hacky.
@sebmarkbage just curious, those this configuration aggregates the code coverage for both jest projects? |
@caridy Good question. I don't know. I didn't actually test the coverage part. @aaronabramov suggested something might be broken in this configuration. |
@caridy when run with multi runner, Jest will aggregate coverage for all of its projects, yes. |
This runs all tests twice when
jest
is ran by default. They all run in a single jest instance and share the workers reporting etc. They can also run individually:This also disables the use of
scripts/fiber/record-tests
in CI but the script still works and only runs the fiber project atm and can be reenabled for any specific project.This should fail one test in CI until #10187 lands.