• Version 27.4.2
  • Published
  • 10.5 kB
  • 4 dependencies
  • MIT license


npm i @jest/test-sequencer
yarn add @jest/test-sequencer
pnpm add @jest/test-sequencer


Overview not available.



class TestSequencer

class TestSequencer {}
  • The TestSequencer will ultimately decide which tests should run first. It is responsible for storing and reading from a local cache map that stores context information for a given test, such as how long it took to run during the last run and if it has failed or not. Such information is used on: TestSequencer.sort(tests: Array) to sort the order of the provided tests.

    After the results are collected, TestSequencer.cacheResults(tests: Array, results: AggregatedResult) is called to store/update this information on the cache map.

method allFailedTests

allFailedTests: (tests: Array<Test>) => Array<Test>;

    method cacheResults

    cacheResults: (tests: Array<Test>, results: any) => void;

      method sort

      sort: (tests: Array<Test>) => Array<Test>;
      • Sorting tests is very important because it has a great impact on the user-perceived responsiveness and speed of the test run.

        If such information is on cache, tests are sorted based on: -> Has it failed during the last run ? Since it's important to provide the most expected feedback as quickly as possible. -> How long it took to run ? Because running long tests first is an effort to minimize worker idle time at the end of a long test run. And if that information is not available they are sorted based on file size since big test files usually take longer to complete.

        Note that a possible improvement would be to analyse other information from the file other than its size.

      Package Files (1)

      Dependencies (4)

      Dev Dependencies (1)

      Peer Dependencies (0)

      No peer dependencies.


      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@jest/test-sequencer.

      • Markdown
      • HTML
        <a href="https://www.jsdocs.io/package/@jest/test-sequencer"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>