AnswerBun.com

Getting typeError: (options.astTransformers || []).map is not a function while running the test suite in Angular

Stack Overflow Asked by soul true on November 28, 2020

I am getting below error while running jest test cases in Angular. All test suites are failing with this error.

Getting typeError: (options.astTransformers || []).map is not a function while running the test suite in Angular

2 Answers

This solution is for Angular 8/9/10

I would recommend doing these steps:

  1. Uninstall jest-preset-angular
  2. Reinstall jest-preset-angular
  3. Clear jest cache
  4. Retry

If the above solution not working, try installing

npm install --dev ts-jest

Answered by San Jaisy on November 28, 2020

Jest configuration for Angular can be tricky.

I recommend you use jest-preset-angular which is a library that you will import into your Angular project that will manage the configuration of Jest for Angular.

This may be related to the update of Jest 27 that deprecated astTransformers as string[].

Configure your Angular project to use Jest 26 with jest-preset-angular and you should be fine

Answered by Yohan Dahmani on November 28, 2020

Add your own answers!

Related Questions

C recursion return values

1  Asked on December 3, 2020 by johnsulaw

       

React and reCAPTCHA v3

3  Asked on December 3, 2020 by comcool

   

Sympy string to equation

1  Asked on December 3, 2020 by mel

   

type casting boost multiprecision integer returns wrong answer

2  Asked on December 3, 2020 by amritkrs

   

clock() returning negative time difference on Windows machine

1  Asked on December 3, 2020 by a-sinha

   

Can I constrain constructor parameters in C#

2  Asked on December 2, 2020 by batekha

 

How to add a number to the picture php

0  Asked on December 2, 2020 by user13670828

         

Flutter: SilverAppBar Background Image with Text

2  Asked on December 2, 2020 by gsk

 

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir