[英]Angular Unit - Testing (Jasmin Karma) : Error :Cannot find name 'google'
google.directives.ts:- 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'.在 jasmin & karma 中测试代码后,出现错误:-> 找不到名称“google”。
How can I solve this issue for unit testing?我该如何解决单元测试的这个问题? I alreday added "googlemaps" in tsconfig.app.json.
我已经在 tsconfig.app.json 中添加了“googlemaps”。
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.无论您对
tsconfig.app.json
进行了何种更改才能使其正常工作,您都必须对tsconfig.spec.json
进行相同的更改才能使单元测试正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.