testSequencer config silently ignored in projects
See original GitHub issueNote: 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 in projects (https://jestjs.io/docs/en/configuration#projects-arraystring--projectconfig)
To Reproduce
Run this config and test sequencer:
module.exports = {
projects: [
{
testEnvironment: 'node',
testSequencer: './jestSequencer.js',
},
],
};
const Sequencer = require('@jest/test-sequencer').default;
console.log('I will never get called.');
class CustomSequencer extends Sequencer {
sort(tests) {
// Test structure information
// https://github.com/facebook/jest/blob/6b8b1404a1d9254e7d5d90a8934087a9c9899dab/packages/jest-runner/src/types.ts#L17-L21
const copyTests = Array.from(tests);
return copyTests.sort((testA, testB) => (testA.path > testB.path ? 1 : -1));
}
}
module.exports = CustomSequencer;
Expected behavior
Jest should warn that the testSequencer should be global config, not per-project.
Original implementation: https://github.com/facebook/jest/issues/6216
Link to repl or repo (highly encouraged)
See above.
envinfo
System:
OS: Linux 4.4 Ubuntu 16.04.5 LTS (Xenial Xerus)
CPU: (4) x64 Intel(R) Xeon(R) Gold 6132 CPU @ 2.60GHz
Binaries:
Node: 12.13.0 - ~/.config/nvm/12.13.0/bin/node
npm: 6.12.0 - ~/.config/nvm/12.13.0/bin/npm
npmPackages:
jest: 25.1.0 => 25.1.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (6 by maintainers)
Top Results From Across the Web
How to run Jest tests sequentially? - Stack Overflow
Note that the testSequencer field has to be global. If you attach it to a project, it'll be validated but then ignored silently....
Read more >Configuring Jest
Use the <rootDir> string token to include the path to your project's root directory to prevent it from accidentally ignoring all of your...
Read more >@jest/test-sequencer | Yarn - Package Manager
Jest will set process.env.NODE_ENV to 'test' if it's not set to something else. You can use that in your configuration to conditionally setup...
Read more >Configuring Vitest
To configure vitest itself, add test property in your Vite config. ... If you are already using unplugin-auto-import in your project, ...
Read more >Reference - Spintop OpenHTF documentation - Read the Docs
The TestPlan is itself a TestSequence and therefore implements all methods defined ... silently load undeclared keys, otherwise warn and ignore the value....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks for the report. I would however say that it is intended that we sort
allTests(as we do in therunJestfunction where the sequencer is called). We should reserve the right to interleave tests of different projects in any way necessary to optimize overall performance. In fact, being smarter about the order of running tests from different projects is something I’ve wanted to improve on for quite some time. I would instead say the expected behavior should be that the config validation throws straight away, instead of silently ignoring the project-level test sequencer option. We can make this issue about fixing that (and label help wanted / good first issue). If someone then wants to sort per project, they can still use the global sequencer and implement it in a way that groups bytest.context.config.nameor something.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. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.