Skip to content

ng test does not honor tsconfig.json compilation options #3911

@JohannesRudolph

Description

@JohannesRudolph

OS?

OS X El Cap.

Versions.

angular-cli: 1.0.0-beta.24
node: 6.9.1
os: darwin x64
@angular/common: 2.4.2
@angular/compiler: 2.4.2
@angular/core: 2.4.2
@angular/forms: 2.4.2
@angular/http: 2.4.2
@angular/platform-browser: 2.4.2
@angular/platform-browser-dynamic: 2.4.2
@angular/router: 3.4.2
@angular/compiler-cli: 2.4.2

Repro steps.

Use this repo: https://github.com/JohannesRudolph/angular-cli-rxjs-repro/tree/test-strict-null-check

It has "strictNullChecks": true in both tsconfig.json files and a .spec file with the following test that tsc in my editor (VSCode) correctly flags with null check errors:

describe('AppComponent', () => {
  beforeEach(() => {
  });

  it('violating null check should raise compilation error', () => {
    let string = '';
    string = null;

    const array = [];
    array.push(1);
  });
});

However, when I run ng test I get none of these errors.

The log given by the failure

I get the following log:

iDevBook01:observable-repro jr$ ng test
09 01 2017 09:25:52.623:WARN [watcher]: Pattern "/Users/jr/dev/tmp/observable-repro/src/assets/**" does not match any file.
09 01 2017 09:26:02.000:WARN [karma]: No captured browser, open http://localhost:9876/   
09 01 2017 09:26:02.008:WARN [karma]: Port 9876 in use
09 01 2017 09:26:02.008:INFO [karma]: Karma v1.2.0 server started at http://localhost:9877/
09 01 2017 09:26:02.009:INFO [launcher]: Launching browser Chrome with unlimited concurrency
09 01 2017 09:26:02.015:INFO [launcher]: Starting browser Chrome
09 01 2017 09:26:03.113:INFO [Chrome 55.0.2883 (Mac OS X 10.11.6)]: Connected on socket /#Ey3SzNdnfw0H2k6BAAAA with id 38623434
Chrome 55.0.2883 (Mac OS X 10.11.6): Executed 1 of 1 SUCCESS (0.009 secs / 0.002 secs)

Mention any other details that might be useful.

This issue may be somewhat related to (but its for sure not the same one) as #2778

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentneeds: investigationRequires some digging to determine if action is neededtype: bug/fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions