模块“ DynamicTestModule”导入的异常值“ SohoComponentsModule”

克里斯·朗

我正在编写一个angular 2应用程序,并且正在使用我们的UI团队的库。应用程序的开发进展顺利,我可以通过使用类似import语句轻松使用其所有组件。这是我的app.module.ts:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { SohoComponentsModule } from '@infor/sohoxi-angular'; // This is the one in question.

import { AppComponent } from './app.component';
import { licenseGeneratorComponent } from './licenseGenerator.component';
import { emergencyLicenseComponent } from './tabs/emergency/emergencyLicense.component';
import { partnerLicenseComponent } from './tabs/partner/partnerLicense.component';
import { standardLicenseComponent } from './tabs/standard/standardLicense.component';

@NgModule({
  declarations: [
    AppComponent,
    licenseGeneratorComponent,
    emergencyLicenseComponent,
    partnerLicenseComponent,
    standardLicenseComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    SohoComponentsModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

这是我在这个应用程序中使用的模板之一,soho的东西来自这个库:

<div class="row">
  <div class="twelve columns">
  <h1>License Generator</h1>
    <div soho-tabs>
      <ul soho-tab-list>
        <li soho-tab><a soho-tab-title tabId='tabs-normal-emergency'>Emergency Licenses</a></li>
        <li soho-tab><a soho-tab-title tabId='tabs-normal-partner'>Partner Licenses</a></li>
        <li soho-tab><a soho-tab-title tabId='tabs-normal-standard'>Standard Licenses</a></li>
      </ul>

      <div soho-tab-panel tabId='tabs-normal-emergency'>
        <emergency-license></emergency-license>
      </div>
      <div soho-tab-panel tabId='tabs-normal-partner'>
        <partner-license></partner-license>
      </div>
      <div soho-tab-panel tabId='tabs-normal-standard'>
        <standard-license></standard-license>
      </div>
    </div>
  </div>
</div>

该应用程序一直运行良好,没有问题。但是,当我的单元测试出现问题时。我让他们在进行前几个单元测试之前就工作了,但是将其搁置了一个星期左右,并添加了更多内容,现在测试无法正常运行。

当我运行测试时,我得到了错误

Unexpected value 'SohoComponentsModule' imported by the module 'DynamicTestModule'

我的app.component.spec看起来像这样:

import { TestBed, async } from '@angular/core/testing';
import { FormsModule } from '@angular/forms';

import { AppComponent } from './app.component';
import { licenseGeneratorComponent } from './licenseGenerator.component';
import { emergencyLicenseComponent } from './tabs/emergency/emergencyLicense.component';
import { partnerLicenseComponent } from './tabs/partner/partnerLicense.component';
import { standardLicenseComponent } from './tabs/standard/standardLicense.component';

import { SohoComponentsModule } from '@infor/sohoxi-angular';

describe('AppComponent', () => {
  beforeEach(() => {
    TestBed.configureTestingModule({
      declarations: [
        AppComponent,
        licenseGeneratorComponent,
        emergencyLicenseComponent,
        partnerLicenseComponent,
        standardLicenseComponent,
      ],
      imports: [
        FormsModule,
        SohoComponentsModule
      ],
    });
  });

  it('should create the app', async(() => {
    let fixture = TestBed.createComponent(AppComponent);
    let app = fixture.debugElement.componentInstance;
    expect(app).toBeTruthy();
  }));

  it(`should have as title 'app works!'`, async(() => {
    let fixture = TestBed.createComponent(AppComponent);
    let app = fixture.debugElement.componentInstance;
    expect(app.title).toEqual('app works!');
  }));
});

我现在绕圈了,因为如果我在测试中删除了import语句,则会引发以下错误:

Can't bind to 'closeOnSelect' since it isn't a known property of 'select'. ("label required">Versions</label>

请帮忙!

请记住,该应用程序仍然可以正常工作,只是给我带来问题的单元测试。我整天都在寻找修复程序,但无法弄清楚。

请让我知道是否需要发布更多文件。谢谢克里斯

克里斯·朗

出于某种原因,导致此问题的是角度库。我更新了版本,此问题已解决。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

模块“ AppModule”声明的异常值“ AnyComponent”

来自分类Dev

模块“ AppModule”声明的异常值“ Component”

来自分类Dev

异常值:在Django中没有名为“ PIL”的模块

来自分类Dev

ImportError异常值:没有名为表单的模块

来自分类Dev

错误:(SystemJS)模块“ AppModule”声明了异常值“ CommonService”

来自分类Dev

django-异常值:没有名为 urls 的模块

来自分类Dev

捕获导入模块中引发的异常

来自分类Dev

失败:由模块“DynamicTestModule”导入的意外指令“ContactDetailsComponent”。请添加@NgModule 注释

来自分类Dev

包含模块时__callee__的异常值–这是一个Ruby错误吗?

来自分类Dev

从...导入或导入...至模块

来自分类Dev

从导入的模块覆盖导入模块的内置功能

来自分类Dev

避免在导入的模块中导入模块

来自分类Dev

使用模块中的异常而不显式导入它

来自分类Dev

与文件同名的导入模块

来自分类Dev

PySpark分发模块导入

来自分类Dev

python:如何导入模块

来自分类Dev

封装导入模块的范围

来自分类Dev

导出导入的模块

来自分类Dev

无法导入模块

来自分类Dev

从python删除导入的模块

来自分类Dev

导入TypeScript模块

来自分类Dev

无法导入模块的属性

来自分类Dev

动态导入模块

来自分类Dev

JavaScript拦截模块导入

来自分类Dev

导入Ansible模块工具

来自分类Dev

Decorator的Python导入模块

来自分类Dev

导入python模块失败

来自分类Dev

Python:导入android模块

来自分类Dev

编辑已导入的模块