npm
npmjs.com › package › jest-preset-angular
jest-preset-angular - npm
1 month ago - Latest version: 16.1.4, last published: 24 days ago. Start using jest-preset-angular in your project by running `npm i jest-preset-angular`. There are 58 other projects in the npm registry using jest-preset-angular.
» npm install jest-preset-angular
Published Apr 09, 2026
Version 16.1.4
GitHub
github.com › thymikee › jest-preset-angular
GitHub - thymikee/jest-preset-angular: Jest configuration preset for Angular projects. · GitHub
Starred by 916 users
Forked by 304 users
Languages TypeScript 89.7% | JavaScript 7.1% | CSS 2.8%
Videos
Thymikee
thymikee.github.io › installation
Installation | jest-preset-angular
1 month ago - import type { Config } from 'jest'; import { createCjsPreset } from 'jest-preset-angular/presets/index.js'; export default { ...createCjsPreset(), setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'], } satisfies Config;
Stack Overflow
stackoverflow.com › questions › 77542575 › setup-jest-with-angular-16
jestjs - Setup jest with angular 16 - Stack Overflow
import { pathsToModuleNameMapper } from 'ts-jest/utils'; import type { Config } from 'jest'; const preset = require('jest-preset-angular/jest-preset'); const { compilerOptions } = require('./tsconfig'); const jestConfig: Config = { preset: 'jest-preset-angular/presets/defaults-esm', setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'], // globals: { // ...preset.globals, // APP_VERSION: { hash: '00000000', describe: 'v0.0.0', short: 'v0.0.0', branch: '_test_', date_short: '00000000' }, // }, globalSetup: 'jest-preset-angular/global-setup', moduleNameMapper: { ...pathsToModuleNameMapper(compilerOpti
npm
npmjs.com › package › @angular-builders › jest
angular-builders/jest
January 14, 2026 - ... $ npm remove karma ... ./src/test.ts · Install the builder (and jest if you still haven't): $ npm i -D jest @types/jest @angular-builders/jest...
» npm install @angular-builders/jest
Published Jan 14, 2026
Version 21.0.3
Medium
dougmbarcellos.medium.com › angular-16-jest-quick-guide-c720774241c7
Angular 16 & Jest | Quick guide. From version 16, Angular enable us to… | by Douglas M. Barcellos | Medium
August 24, 2023 - "test": { "builder": "@angular-devkit/build-angular:jest", "options": { "polyfills": [ "zone.js", "zone.js/testing" ], "tsConfig": "tsconfig.spec.json" } } Last step is change “jasmine” for “jest” in types option in tsconfig.spec.json file: { "extends": "./tsconfig.json", "compilerOptions": { "outDir": "./out-tsc/spec", "types": ["jest"] // jasmine -> jest }, "include": [ "src/**/*.spec.ts", "src/**/*.d.ts" ] }
Medium
medium.com › @zeeshankhan8838 › unit-testing-angular-with-jest-configuration-e324ec61620c
Jest Configuration in angular. In this article, I am writing about all… | by zeeshan khan | Medium
March 22, 2023 - "jest": { "preset": "jest-preset-angular", "setupFilesAfterEnv": [ "<rootDir>/src/setup.jest.ts" ], "testPathIgnorePatterns": [ "<rootDir>/node_modules/", "<rootDir>/dist/" ], "globals": { "ts-jest": { "tsConfig": "<rootDir>/tsconfig.spec.json", "stringifyContentPathRegex": "\\.html$" } } } "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "watch": "ng build --watch --configuration development", "test": "jest", "test:watch": "jest --watch", "test:coverage": "jest --coverage" },
Top answer 1 of 5
4
If you use Angular CLI this library would be very helpful.
It will allow you to keep your workspace clear of boilerplate code related to Jest setup and also run your tests with Angular CLI (ng test).
This will also save you the trouble of configuring Jest.
As for your specific error, it is most probably related to your tsconfig.spec.json. Have you changed the module field to commonjs? This is required to make Jest work.
For more details read this article.
Disclaimer: I'm the owner of this library.
2 of 5
1
I tried a couple of weeks ago following this article.
It went smooth but I decided to not move from Jasmine/Karma to Jest. The reasons:
- I need to run UTs on multiple real browsers and Jest can't do it. (Read the discussion on the Jest Repository
- I can use Jasmin to write also e2e tests using Protractor or Selenium-Webdriver
DEV Community
dev.to › fransaoco › how-to-set-up-jest-in-angular-19-step-by-step-guide-1c2p
How to Set Up Jest in Angular 19 (Step-by-Step Guide) - DEV Community
April 21, 2025 - module.exports = { preset: 'jest-preset-angular', setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'], testPathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/dist/'], transform: { '^.+\\.ts$': 'ts-jest', // Only transform .ts files }, transformIgnorePatterns: [ '/node_modules/(?!flat)/', // Exclude modules except 'flat' from transformation ], }; import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'; setupZoneTestEnv(); { "extends": "./tsconfig.json", "compilerOptions": { "outDir": "./out-tsc/spec", "types": ["jest", "node"] }, "include": [ "src/**/*.spec.ts", "src/**/*.d.ts" ] } "test": { "builder": "@angular-devkit/build-angular:jest", "options": { "tsConfig": "tsconfig.spec.json" } } "compilerOptions": { "baseUrl": "./", ...
GitHub
github.com › stephanrauh › angular-jest
GitHub - stephanrauh/angular-jest: Testing Angular with Jest · GitHub
You find the result in the Angular 17 folder. It's probably not perfect: the Angular team hasn't published a tutorial yet (or I didn't find it), so much of my code is guesswork. Before Angular 16, there was no official support for Jest, but several great community solutions.
Starred by 27 users
Forked by 9 users
Languages HTML 60.5% | TypeScript 35.8% | JavaScript 3.1%