-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
testSequencer config silently ignored in projects #9761
Comments
Thanks for the report. I would however say that it is intended that we sort |
@thernstig would you be fine with that change? You could edit the issue or I can, whatever suits you :) |
@jeysal What I am trying to achieve is to run end-to-end tests. Our end goal is to run them in parallel, but right now we want to run a login suite first (hence the sequencer) and then the rest (using a custom test runner with isSerial=true). Reading back on many issues from the past, this seem to be more and more common, seeing as Jest is awesome and thus users want to use it for also e2e tests. Thus, using projects for this is nice if I could use a testSequencer just for that project, the e2e project. I am afraid that for me, that have not looked deeply into the what What is your suggestion to this problem then? I do understand the logic for properly sequencing is important for performance, but having a project used for e2e is a different beast. |
Well, to be fair, manually writing a test sequencer is generally something that requires knowledge of some Jest internals, like writing a runner or an environment.
|
Yes, fair points. I am pretty sure I can work around this regardless by introspecting everything in the sequencer. I've actually already got a way since I know the test case name for the login suite will be copyTests.sort((testA, testB) => {
if (testA.path && testA.path.endsWith('login.e2e.test.js')) return -1;
if (testB.path && testB.path.endsWith('login.e2e.test.js')) return 1;
return 0;
}); Problem solved! :) I think this issue more is so that if you have a sequencer inside a project, you still want the main sequencer to sort in whatever way, and then the project sequencer sorts it an additional time for just the test cases in that project root. This would mean the main/top-level sequencer would sort "slowest first" (or any other performance enhancers) whilst the internal sort when will sort by name. The I think I come from the perspective that e2e testing is common, jest awesome, and more users want to use Jest for it's power to run various kind of projects. (no matter - throwing is better than anything even though I obviously wish there was a way to use a sequencer in projects as well 😄) |
I think we want to keep the concept of a test sequencer very lightweight (like just swapping out the |
Could you elaborate this part, for reference (for me and maybe others in the future) with some code? Appreciate it.
|
Looks like it's not actually possible exactly the way I described it, since Jest's default sequencer does not expose its order function. But since import defaultSequencer from '@jest/test-sequencer';
// ... in your sort method
const preSortedTests = defaultSequencer.sort([...tests]);
// ... your custom sort on preSortedTests and then do your sort - everything where you don't define an order ( |
Thanks @jeysal, already solved this some time ago by using the defaultSequencer's sort, worked great - even tested it to make sure it ran "slow/failed first". 😃 |
hey, I want to contribute. please guide me on how to start contributing. I have fork and clone it and set the environment for this in my pc. |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
https://github.com/facebook/jest/blob/main/CONTRIBUTING.md |
I challenge to contribute. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Note: This is fundamentally working as intended, this issue is now about validating the config and providing a sufficient warning.
🐛 Bug Report
The configuration
testSequencer
(https://jestjs.io/docs/en/configuration#testsequencer-string) is silently ignored inprojects
(https://jestjs.io/docs/en/configuration#projects-arraystring--projectconfig)To Reproduce
Run this config and test sequencer:
Expected behavior
Jest should warn that the
testSequencer
should be global config, not per-project.Original implementation: #6216
Link to repl or repo (highly encouraged)
See above.
envinfo
The text was updated successfully, but these errors were encountered: