2025-12-02

How to Fix Karma in Angular 20: The "Missing Builder" Error Solved

Angular 20 removed the Karma builder. Learn exactly how to restore it temporarily or migrate to Vitest in 5 minutes.

AC

Written in December 02, 2025 by Antonio Cárdenas

Frontend Developer & GDE

How to Fix Karma in Angular 20: The "Missing Builder" Error Solved

You just finished the upgrade. You ran ng update, everything looked green, and you felt great. Then you typed ng test and the terminal screamed at you:

bash
1Schema validation failed with the following errors: 2Data path "" must have required property 'karmaConfig'

If you are staring at this error, you are not alone. In Angular 20, the team finally pulled the plug on the legacy build system. Here is exactly why this broke, and the two ways you can fix it—whether you need a quick patch or a permanent solution.

The "Why": Goodbye Webpack, Hello esbuild

For years, Angular relied on Webpack to bundle your code and Karma to run your tests in a real browser. It worked, but it was slow.

In Angular 20, the CLI defaults entirely to the new Application Builder based on esbuild and Vite. This new builder is blazingly fast, but it has one catch: It does not support Karma.

When you run ng test now, the CLI is looking for a Karma configuration that the new builder simply doesn't understand.

Solution A: The "Quick Fix" (Retro-fitting)

Use this if you have a massive test suite (500+ tests) and cannot afford to rewrite them today.

To get your tests passing again without changing a single line of test code, we need to manually reinstall the "Legacy" builder that Angular 20 doesn't include by default.

Step 1: Install the Legacy Builder

Run this command to bring back the Webpack-based architecture:

bash
1npm install --save-dev @angular-devkit/build-angular

Step 2: Update angular.json

You need to tell Angular to stop using the new application builder for tests and go back to the old browser builder.

Open your angular.json and find the "test" target. Change the builder string:

json
1"test": { 2 // CHANGE THIS LINE: 3 // "builder": "@angular/build:test", 4 5 // TO THIS: 6 "builder": "@angular-devkit/build-angular:karma", 7 "options": { 8 "polyfills": ["zone.js", "zone.js/testing"], 9 "tsConfig": "tsconfig.spec.json", 10 "karmaConfig": "karma.conf.js" 11 } 12}

Run ng test again. It will be slower than the new tools, but it will work.

Solution B: The "Real Fix" (Migrate to Vitest)

Use this if you want instant test feedback and future-proof code. This is the GDE-recommended path.

The ecosystem has moved on. Vitest is the spiritual successor to Karma/Jasmine but runs on Vite. It is instant, headless by default, and fully compatible with Angular 20.

Step 1: Run the Experimental Migration

Angular 20 includes a schematic to do the heavy lifting for you.

bash
1ng generate @angular/core:testing

Note: Select "Vitest" when prompted.

Step 2: Verify angular.json

The CLI should automatically update your builder to the new experimental runner:

json
1"test": { 2 "builder": "@angular/build:test", // The new standard 3 "options": { 4 "runner": "vitest" 5 } 6}

Why you should switch today

I recently migrated a client's government dashboard from Karma to Vitest. Look at the difference:

| Feature | Karma (Legacy) | Vitest (Modern) | | :--- | :--- | :--- | | Startup Time | 12s - 20s | < 400ms | | Engine | Real Browser (Chrome) | Vite (Node.js/JSDOM) | | Debugging | Browser Console | Terminal / VS Code | | Future Proof? | ❌ Deprecated | ✅ Industry Standard |

Final Thoughts

The error must have required property 'karmaConfig' is annoying, but it's a signal. It's the framework telling you that the tools of 2016 (Webpack/Karma) are no longer the tools of 2025.

If you are on a tight deadline, use Solution A. But put a ticket in your backlog to implement Solution B. Your CI/CD pipeline (and your developers) will thank you.

Need help migrating a complex repo? Check out my GDE profile or ping me on Twitter.

Subscribe to my newsletter to get the latest updates.