我在使用带有Angular和Docker的Karma时遇到了问题。
输入ng test
Uncaught TypeError: Object prototype may only be an Object or null: undefined
at http://localhost:9876/_karma_webpack_/main.js:571
我不知道它可能来自哪里。在Google上搜索后,看起来它可能是导入订单问题或扩展问题。
这里我有一个ApiService:
import { Injectable } from '@angular/core';
import Base from '@app/core/services/api/base';
import { from , Observable } from 'rxjs';
import { environment } from '@environments//environment';
@Injectable({
providedIn: 'root'
})
export class ApiService {
protected site: string;
protected housing: string;
protected building: string;
protected common: string;
constructor() {
}
getDatas( params ) {
return from( new Base({modelName: `${environment.api.apiVersion}/${params}`}).get());
}
}
这是我扩展此服务的地方:
import { ApiService } from '@app/core/services/api.service';
import { Observable } from 'rxjs';
class Topology extends ApiService {
constructor(private type: string) {
super();
}
/*
* b2b
*/
getBuilding() {
return this.getDatas(`${this.type}/topology/building/${this.building}`);
}
}
export default Topology;
我环顾四周,找不到任何解决方案。有任何想法吗?感谢