1
ng new
(@angular/[email protected]
)を使用して、新しい角型2アプリを作成しました。予想通りコンパイルエラーが発生してもAngular 2テストはどのように合格になりますか?
// src/app/app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title: number = 'app works!';
}
npm start
エラーアウト:
Chrome 56.0.2924 (Mac OS X 10.11.6): Executed 3 of 3 SUCCESS (0.254 secs/0.25 secs)
:
ERROR in /Users/administrator/Workspaces/Scratch/test-app/src/app/app.component.ts (9,3): Type 'string' is not assignable to type 'number'.)
webpack: Failed to compile.
はまだnpm test
は3つの成功したテストを示し続けます
これはどのように可能ですか?コンパイルエラーがある場合にテストが失敗するのを防ぐための推奨される方法はありますか?
ありがとうございます!
ありがとうございますが、再コンパイルされているようです。 'const foo:number = 'bar';'をファイルの先頭に追加すると、結果のビルドファイルで 'var foo = 'bar';'(Chromeソースを介して)見ることができます。 – mponizil