jest-runner-rollup

raw JSON →
1.3.9 verified Mon Apr 27 auth: no javascript maintenance

Jest runner for Rollup, designed to integrate Rollup bundling into Jest test runs. Currently at version 1.3.9 (last released in 2020), it works with Rollup ^1.29.1 and Node >=10.13. It plays well in monorepo scenarios, using Jest's runner API to bundle test files with Rollup before execution. Key differentiators: seamless monorepo support, simple configuration, and leverages Rollup's tree-shaking for faster test runs. However, it is no longer actively maintained and may not work with modern Rollup versions (v2+).

error Cannot find module 'rollup'
cause Missing peer dependency rollup (required version ^1.29.1).
fix
Install rollup@^1.29.1: npm install rollup@1.29.1 --save-dev
error TypeError: runner is not a constructor
cause Attempted to use `new require('jest-runner-rollup')()` but the package exports a function, not a class.
fix
Set runner: 'jest-runner-rollup' in Jest config instead of using runner: require('jest-runner-rollup').
error Jest: 'runner' option must be a string, a class, or a function.
cause Passed an object or other invalid type as runner value.
fix
Use a string like 'jest-runner-rollup' or a valid runner class/function.
deprecated jest-runner-rollup is no longer actively maintained; last release in 2020. May have compatibility issues with modern Rollup v2+ and Jest versions >=27.
fix Consider alternatives like @rollup/jest-transform or rollup-jest.
gotcha Requires Rollup ^1.29.1 as a peer dependency. Using with Rollup v2+ may cause unexpected errors due to API changes.
fix Pin Rollup to version ^1.29.1 or use a different Jest runner that supports Rollup v2+.
gotcha The package exposes a default export (a function), not a class. Using `new Runner()` will fail.
fix Set `runner: 'jest-runner-rollup'` in Jest config (string) rather than trying to import and instantiate.
npm install jest-runner-rollup
yarn add jest-runner-rollup
pnpm add jest-runner-rollup

Configures Jest to use jest-runner-rollup as the default test runner, enabling Rollup bundling for each test file.

// jest.config.js
module.exports = {
  runner: 'jest-runner-rollup',
  testEnvironment: 'node',
  testMatch: ['**/__tests__/**/*.test.js'],
  // Optional Rollup config passed to runner:
  // rollupConfig: {
  //   input: 'src/index.js',
  //   plugins: [/* your rollup plugins */]
  // }
};