Home > Software design >  Angular Unit - Testing (Jasmin Karma) : Error :Cannot find name 'google'
Angular Unit - Testing (Jasmin Karma) : Error :Cannot find name 'google'

Time:01-20

google.directives.ts:-

  getAutocompletes(addresstext: ElementRef) {
    const autocomplete = new  google.maps.places.Autocomplete(addresstext.nativeElement,
      {
       ...
      });
  google.maps.event.addListener(autocomplete, 'place_changed', () => 
  {
   ...
  }

after testing code in jasmin & karma, I got Error :-> Cannot find name 'google'.

How can I solve this issue for unit testing? I alreday added "googlemaps" in tsconfig.app.json.

CodePudding user response:

Whatever change you made for tsconfig.app.json for it to work, you have to do the same change to tsconfig.spec.json for the unit tests to work.

  • Related