使用jQWidgets和Karma/Jasmine对Angular应用程序进行单元测试

使用jQWidgets和Karma/Jasmine对Angular应用程序进行单元测试,angular,karma-jasmine,jqwidget,Angular,Karma Jasmine,Jqwidget,如果有人创建了带有jQWidgets的jasmine/karma角度测试-即使您没有遇到此错误,我也希望看到您的karma.conf.js和.spec文件,因为我遇到了一个问题 我能够很好地为应用程序服务-该应用程序比Angular提供的启动器稍多,但我的.spec组件单元测试在karma中抛出了这个错误: Failed: Unexpected value ‘undefined’ declared by the module ‘DynamicTestModule’ 在我的等级库文件中: imp

如果有人创建了带有jQWidgets的jasmine/karma角度测试-即使您没有遇到此错误,我也希望看到您的karma.conf.js和.spec文件,因为我遇到了一个问题

我能够很好地为应用程序服务-该应用程序比Angular提供的启动器稍多,但我的.spec组件单元测试在karma中抛出了这个错误:

Failed: Unexpected value ‘undefined’ declared by the module ‘DynamicTestModule’
在我的等级库文件中:

import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { jqxGridComponent } from 'jqwidgets-scripts/jqwidgets-ts/angular_jqxgrid';

describe('AppComponent', () => {
  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [jqxGridComponent, AppComponent]
    }).compileComponents();
  }));

  it('app dummy test', () => {
    expect(1).toBe(2);
  });
});
app.component.ts:

import { Component } from '@angular/core';
import { jqxGridComponent } from 'jqwidgets-scripts/jqwidgets-ts/angular_jqxgrid';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  constructor() {}
}
app.module.ts:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

import { jqxGridComponent } from 'jqwidgets-scripts/jqwidgets-ts/angular_jqxgrid';

@NgModule({
  declarations: [AppComponent, jqxGridComponent],
  imports: [BrowserModule],
  providers: [],
  bootstrap: [AppComponent] 
})
export class AppModule {} 

如果有任何帮助和/或jqWidget测试示例,我将不胜感激

在tsconfig.spec.json中,包括jqwidgets文件路径:

"include": [
    "**/*.spec.ts",
    "**/*.d.ts",
    "../node_modules/jqwidgets-scripts/jqwidgets-ts"
  ]