Skip to content

ng test not reporting TypeScript errors #5863

Closed
@jeffkenney

Description

@jeffkenney

Bug Report or Feature Request (mark with an x)

- [x] bug report
- [ ] feature request

Versions.

@angular/cli: 1.0.0
node: 6.9.1
os: darwin x64 (El Capitan)
@angular/common: 4.0.1
@angular/compiler: 4.0.1
@angular/core: 4.0.1
@angular/forms: 4.0.1
@angular/http: 4.0.1
@angular/platform-browser: 4.0.1
@angular/platform-browser-dynamic: 4.0.1
@angular/router: 4.0.1
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.1

Repro steps.

  • Perform a fresh install with ng new
  • Add the following test to src/app/app.component.spec.ts
it('should not compile if there are TypeScript errors', () => {
  const myFunc = (arg: string) => {};
  myFunc(1);
});
  • run ng test --single-run and see that there are no errors
  • run tsc --project src/tsconfig.spec.json and see a type error

The log given by the failure.

No errors are reported. The code compiles and the tests pass.

Desired functionality.

The following compilation error should be reported and the tests should not be run:

src/app/app.component.spec.ts(39,12): error TS2345: Argument of type '1' is not assignable to parameter of type 'string'.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions