Skip to content

testSequencer config silently ignored in projects #9761

@thernstig

Description

@thernstig

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 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: #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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions