2

ではありません失敗しました - >イオン2カルマのテストは、「イオンラベルは」私は私のコンポーネントでこのエラーを取得していますNPMのテストを実行するには、既知の要素

**Can't bind to 'formGroup' since it isn't a known property of 
    'form'. 
    (" 
    </div> 
<form [ERROR ->][formGroup]="loginForm" text-center> 
<ion-list> 
"): ng:///DynamicTestModule/[email protected]:6 
'ion-label' is not a known element: 
1. If 'ion-label' is an Angular component, then verify that it is part 
of this module. 
2. If 'ion-label' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' 
to the '@NgModule.schemas' of this component to suppress this message. 
(" 
<ion-item> 
    [ERROR ->]<ion-label floating>Email</ion-label> 
    <ion-input type="email" formControlName="email" [class.inva"): 
ng:///DynamicTestModule/[email protected]:4 
'ion-input' is not a known element: 
1. If 'ion-input' is an Angular component, then verify that it is part 
of this module. 
2. If 'ion-input' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. (" 
<ion-item> 
    <ion-label floating>Email</ion-label> 
    [ERROR ->]<ion-input type="email" formControlName="email" [class.invalid]="!loginForm.controls.email.valid && ("): ng:///DynamicTestModule/[email protected]:4 
'ion-item' is not a known element: 

** 1。 'イオンアイテム'が角度成分である場合、それがこのモジュールの一部であることを確認します。 2. 'ion-item'がWebコンポーネントの場合は、このコンポーネントの '@ NgModule.schemas' enter code hereに 'CUSTOM_ELEMENTS_SCHEMA'を追加して、このメッセージを表示しないようにします。 (」 [ERROR - >] ****

テストスイートを構成するときに、これは私のtest.tsある

 import 'zone.js/dist/long-stack-trace-zone'; 
     import 'zone.js/dist/proxy.js'; 
import 'zone.js/dist/sync-test'; 
import 'zone.js/dist/jasmine-patch'; 
import 'zone.js/dist/async-test'; 
import 'zone.js/dist/fake-async-test'; 

import { FormsModule, ReactiveFormsModule } from '@angular/forms'; 
import { getTestBed, TestBed } from '@angular/core/testing'; 
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; 
import { App, Config, Form, IonicModule, Keyboard, DomController, MenuController, NavController, Platform } from 'ionic-angular'; 
import { ConfigMock } from './mocks'; 




// Unfortunately there's no typing for the `__karma__` variable. Just 
declare it as any. 
declare var __karma__: any; 
declare var require: any; 

// Prevent Karma from running prematurely. 
__karma__.loaded = function(): void { 
    // noop 
}; 

// First, initialize the Angular testing environment. 
getTestBed().initTestEnvironment(
    BrowserDynamicTestingModule, 
    platformBrowserDynamicTesting(), 
); 

// Then we find all the tests. 
let context: any = require.context('./', true, /\.spec\.ts/); 

// And load the modules. 
context.keys().map(context); 

// Finally, start Karma to run the tests. 
__karma__.start(); 
`` 
+0

はこれを見ている:https://angular.io/docs/ts/latest/guide/forms.html – Nico

答えて

3

あなたはIonicModuleをインポートしました()test.tsのよう 何か:

を?
public static configureIonicTestingModule(components: Array<any>): typeof TestBed { 
    return TestBed.configureTestingModule({ 
    declarations: [ 
     ...components, 
    ], 
    providers: [ 
     App, Form, DomController 
    ], 
    imports: [ 
     FormsModule, 
     IonicModule, // <- this here 
    ], 
    }); 
} 
+0

かを理解することはできません私は、私はこれが –

+0

@sachinkaushik私test.tsであることを追加する必要がありますテストにはおそらくkarma.conf.tで定義されているテストエントリポイントがあります。通常はsrc/test.tsです。これをkarma.conf.jsに定義されているこのtest.tsに追加する必要があります –

+0

私は同じ問題に直面していますが、今はこれを取得しています。 Error:FormGroupのすべてのパラメータを解決できません:(?、?、? )。 –

関連する問題