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! [email protected] test: `ng test --watch=false --browsers=ChromeHeadless`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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 ?

3
  • Potential duplicate of stackoverflow.com/questions/42394697/… Commented Mar 27, 2021 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. Commented Mar 27, 2021 at 16:23
  • Edit your post and add the workflow yaml, otherwise it's difficult to help. Commented Apr 12, 2021 at 20:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.