ternTS · Guide

A faster Jest transform for TypeScript.

Most of a TypeScript test run under ts-jest goes to compiling your test files. ternTS does that part 9× faster, with the same output tsc would give, and you switch with one line of config.

Jest transform, steady stateNestJS repository, one worker, source maps; ms (shorter is better)
ternts/jest267
@swc/jest392
ts-jest2,390

Switch in one line

npm i -D @ternlang/ternts@experimental

From ts-jest

// jest.config.js
module.exports = {
  transform: {
    '^.+\\.(t|j|mj)sx?$': ['@ternlang/ternts/jest', { tsconfig: 'tsconfig.json' }],
  },
};

Remove preset: 'ts-jest' if you have it. ternTS reads tsconfig.json from Jest’s rootDir by default, so { tsconfig: ... } is only needed for another file (or false for none).

From @swc/jest

Replace '@swc/jest' with '@ternlang/ternts/jest' in the same transform entry, and you can delete .swcrc: the options come from your tsconfig, as they do for tsc.

What it does for you

It’s been run against real suites: all 3,631 of Nest’s unit tests pass with it, and so do Immich’s server tests.

Vitest

Vitest compiles TypeScript with esbuild, which doesn’t emit decorator metadata. The ternTS plugin compiles it the way tsc does instead:

// vitest.config.ts
import { defineConfig } from 'vitest/config';
import ternts from '@ternlang/ternts/vite';

export default defineConfig({ plugins: [ternts()] });

What it doesn’t do

Like @swc/jest, it doesn’t type check. ts-jest’s isolatedModules: false mode reports type errors while tests run; with ternTS, run tsc --noEmit separately. ternTS is experimental: if a test behaves differently than under ts-jest, please open an issue.

Apple M4 Pro, Node 24. Each transformer’s own process() over all 1,959 files of the NestJS repository in one process, best of three passes, no Jest cache; ts-jest in its faster isolatedModules mode, so a default ts-jest setup is slower still. node bench/jest.mjs in the ternTS repository reproduces it.