How to use @jest/test-sequencer - 4 common examples

To help you get started, we’ve selected a few @jest/test-sequencer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mugli / orkid-node / jest.customsequencer.js View on Github external
/* eslint-disable  */
const Sequencer = require('@jest/test-sequencer').default;

class CustomSequencer extends Sequencer {
  sort(tests) {
    // Test structure information
    // https://github.com/facebook/jest/blob/6b8b1404a1d9254e7d5d90a8934087a9c9899dab/packages/jest-runner/src/types.ts#L17-L21
    return Array.from(tests).sort((testA, testB) => (testA.path > testB.path ? 1 : -1));
  }
}

module.exports = CustomSequencer;

/* eslint-enable  */
github Voxelum / minecraft-launcher-core-node / scripts / test-sequencer.js View on Github external
const TestSequencer = require('@jest/test-sequencer').default;

class CustomSequencer extends TestSequencer {
    sort(tests) {
        return tests.sort((testA, testB) => {
            if (testA.path.indexOf('packages/installer') !== -1) {
                return -1;
            }
            if (testB.path.indexOf('packages/installer') !== -1) {
                return 1;
            }
            if (testA.path.indexOf('packages/forge-installer') !== -1
                && testB.path.indexOf('packages/liteloader') !== -1) {
                return -1;
            }
            if (testB.path.indexOf('packages/forge-installer') !== -1
                && testA.path.indexOf('packages/liteloader') !== -1) {
github gitlabhq / gitlabhq / scripts / frontend / parallel_ci_sequencer.js View on Github external
const Sequencer = require('@jest/test-sequencer').default;

const sortByPath = (test1, test2) => {
  if (test1.path < test2.path) {
    return -1;
  }
  if (test1.path > test2.path) {
    return 1;
  }
  return 0;
};

class ParallelCISequencer extends Sequencer {
  constructor() {
    super();
    this.ciNodeIndex = Number(process.env.CI_NODE_INDEX || '1');
    this.ciNodeTotal = Number(process.env.CI_NODE_TOTAL || '1');
github gocodebox / lifterlms / packages / scripts / e2e / sequencer.js View on Github external
/**
 * Jest tests sequencer
 *
 * Runs our tests in alphabetical order by directory / filename.
 *
 * This allows us to do things like run the setup wizard tests to further bootstrap
 * the testing environment for other tests.
 *
 * @link https://jestjs.io/docs/en/next/configuration#testsequencer-string
 */

const Sequencer = require('@jest/test-sequencer').default;

class CustomSequencer extends Sequencer {
	sort( tests ) {
		const copyTests = Array.from( tests );
		return copyTests.sort( ( testA, testB ) => ( testA.path > testB.path ? 1 : -1 ) );
	}
}

module.exports = CustomSequencer;

@jest/test-sequencer

MIT
Latest version published 24 days ago

Package Health Score

95 / 100
Full package analysis

Popular @jest/test-sequencer functions

Similar packages