0

My website is building fine on local but on running npm run test in GitHub Actions .yml file , which maps to ng test --watch=false --browsers=ChromeHeadless. I'm getting an error :

    - Generating browser application bundles...
27 03 2021 14:48:27.375:INFO [karma-server]: Karma v5.1.1 server started at http://localhost:9876/
27 03 2021 14:48:27.377:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited
27 03 2021 14:48:27.381:INFO [launcher]: Starting browser ChromeHeadless
✔ Browser application bundle generation complete.

Error: src/app/dashboard/header/header.component.ts:39:27 - error TS2304: Cannot find name 'google'.

39       this.geoCoder = new google.maps.Geocoder;
                             ~~~~~~
src/app/dashboard/header/header.component.ts:41:32 - error TS2304: Cannot find name 'google'.

41       const autocomplete = new google.maps.places.Autocomplete(this.searchElementRef.nativeElement, this.option);
                                  ~~~~~~
src/app/dashboard/header/header.component.ts:45:24 - error TS2503: Cannot find namespace 'google'.

45           const place: google.maps.places.PlaceResult = autocomplete.getPlace();
                          ~~~~~~
src/app/login/login.component.ts:52:27 - error TS2304: Cannot find name 'google'.

52       this.geoCoder = new google.maps.Geocoder;
                             ~~~~~~
src/app/login/login.component.ts:61:32 - error TS2304: Cannot find name 'google'.

61       const autocomplete = new google.maps.places.Autocomplete(this.searchElementRef.nativeElement, this.option);
                                  ~~~~~~
src/app/login/login.component.ts:65:24 - error TS2503: Cannot find namespace 'google'.

65           const place: google.maps.places.PlaceResult = autocomplete.getPlace();
                          ~~~~~~



npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! senior-viewer-angular@0.0.0 test: `ng test --watch=false --browsers=ChromeHeadless`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the senior-viewer-angular@0.0.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2021-03-27T14_48_29_621Z-debug.log
Error: Process completed with exit code 1.

my tsconfig.app.json file:

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "./out-tsc/app",
    "types": [
      "googlemaps"
    ]
  },
  "files": [
    "src/main.ts",
    "src/polyfills.ts"
  ],

  "include": [
    "src/**/*.d.ts"
  ]
}

Can anybody help me with how to fix this ?

riQQ
  • 9,878
  • 7
  • 49
  • 66
ZSid
  • 1
  • 1
  • Potential duplicate of https://stackoverflow.com/questions/42394697/angular2-cannot-find-namespace-google – francojay Mar 27 '21 at 15:29
  • @francojay No , I have tried all the solution given here. It didnt fixed anything. ng test is working fine locally but failing on github action job. – ZSid Mar 27 '21 at 16:23
  • Edit your post and add the workflow yaml, otherwise it's difficult to help. – riQQ Apr 12 '21 at 20:14

0 Answers0