小编Pat*_*ler的帖子

是否可以在 Angular-CLI 中使用 eslint

我成功为节点配置了eslint(npm run eslint);但我无法将 Angular-CLI 配置为在此配置中使用 eslint;它总是使用 tslint。

我搜索了各种在线资源,但只发现了一个提示,表明这可能根本不受支持。

有可能实现这一目标,还是我在这里坚持使用 tslint?

eslint angular-cli

5
推荐指数
0
解决办法
254
查看次数

无法测试使用翻译管道的组件(找不到管道“翻译”)

我有一个使用 ngx-translate 进行本地化的组件。创建模块的基本单元测试不起作用。它失败并出现以下错误:

PatientDataComponent should create FAILED
   [ERROR ->]{{ 'patient.information' | translate }}
  </p>
  The pipe 'translate' could not be found ("<p>[ERROR ->]{{ 'patient.information' | translate }}</p>"): ng:///DynamicTestModule/PatientDataComponent.html@1:2
error properties: Object({ ngSyntaxError: true, ngParseErrors: [ The pipe 'translate' could not be found ("<p>"): ng:///DynamicTestModule/PatientDataComponent.html@1:2 ] })
Run Code Online (Sandbox Code Playgroud)

该应用程序能够切换语言;因此 ngx-translate 似乎有效。除了我的单元测试。测试代码如下:

import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PatientDataComponent } from './patient-data.component';

describe('PatientDataComponent', () => {
  let component: PatientDataComponent;
  let fixture: ComponentFixture<PatientDataComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [PatientDataComponent]
    }) …
Run Code Online (Sandbox Code Playgroud)

jasmine typescript ngx-translate angular

3
推荐指数
1
解决办法
8397
查看次数