jest-schematic
jest-schematic copied to clipboard
Validation Error: Preset jest-preset-angular not found.
Describe the bug After running the command "ng add @briebug/jest-schematic" inside of my angular app and then running "ng test", I receive an error:
Validation Error:
Preset jest-preset-angular not found.
Configuration Documentation: https://jestjs.io/docs/configuration
To Reproduce
- Create a new ng app via CLI
- Navigate to new app folder via CLI
- execute CLI command "ng add @briebug/jest-schematic"
- execute CLI command "ng test"
Expected behavior I expected the 3 default unit tests in my app.component.spec.ts to pass successfully.
Screenshots

Desktop (please complete the following information):
- OS: Windows 10
- Node version: v16.13.0
- App type: Angular CLI
- Angular version: 13.3.7
Additional context
I have this exact same issue, using angular 14.2.1
Have you been able to work around this?
To get it working, I did the following:
npm install -D jest jest-preset-angular
in setup-jest.ts:
change import 'jest-preset-angular/setup-jest'; to import 'jest-preset-angular';
I still see some issues in test-config.helper.ts. Since Angular 14.2 TestBed.configureCompiler returns a void instead of TestBedStatic.

When I delete test-config.helper.ts, everything still seems to run fine. Is this file still needed for something?
I also have this same issue with the test-config.helper.ts file. How can this be fixed? Just deleting the file seems a little risky for me. @schuchard What is the current status of this and how can this be fixed?
Can you test with latest v5.0.0 and let me know if that helps? test-config.helper.ts has been removed.