close

pool

  • Type:
export type RstestPoolType = 'forks';

export type RstestPoolOptions = {
  /** Pool used to run tests in. */
  type?: RstestPoolType;
  /** Maximum number or percentage of workers to run tests in. */
  maxWorkers?: number | string;
  /** Minimum number or percentage of workers to run tests in. */
  minWorkers?: number | string;
  /** Pass additional arguments to node process in the child processes. */
  execArgv?: string[];
};

export type RstestConfig = {
  /** Pool used to run tests in. */
  pool?: RstestPoolType | RstestPoolOptions;
};
  • Default:
const defaultPool = {
  type: 'forks',
  // maxWorkers/minWorkers are computed from CPU count and command mode
};

Options of pool used to run tests in.

Example

Shorthand

You can use a string shorthand to set the pool type:

rstest.config.ts
import { defineConfig } from '@rstest/core';

export default defineConfig({
  pool: 'forks',
});

This is equivalent to:

rstest.config.ts
import { defineConfig } from '@rstest/core';

export default defineConfig({
  pool: {
    type: 'forks',
  },
});

Run all tests inside a single child process.

rstest.config.ts
import { defineConfig } from '@rstest/core';

export default defineConfig({
  pool: {
    type: 'forks',
    maxWorkers: 1,
    minWorkers: 1,
  },
});