Skip to content

"ng test" does not bail on type definition errors #3424

Closed

Description

@huyph

OS

Mac OSX - EL Capitan

Versions.

angular-cli: 1.0.0-beta.19-3
node: 6.4.0
os: darwin x64

Repro steps.

  • Have a default angular-cli setup in place (by running "ng new <project_name>")
  • Then there should be AppComponent and its spec file created by default.
  • Add a new method in app.component.ts:
public static returnAorB(character: 'A' | 'B') {
  return character;
}

And add following line anywhere in app.component.spec.ts:

expect(AppComponent.returnAorB('C')).toEqual('C');
  • Run "ng test --watch=false"

It will generate an error complaining Argument of type '"C"' is not assignable to parameter of type '"A" | "B"'. But the command did not exit.

The log given by the failure.

....
ERROR in [default] <path>/src/app/app.component.spec.ts:16:35 
Argument of type '"C"' is not assignable to parameter of type '"A" | "B"'.
.....
(Completes and Exits with successful code)

Activity

  1. hansl commented on Dec 6, 2016

    @hansl
    Contributor

    Right, we don't check for build errors on test. That's a bug, thanks! Will fix.

  2. added
    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
    on Dec 6, 2016
  3. JohannesRudolph commented on Dec 8, 2016

    @JohannesRudolph
    Contributor

    I think this is a duplicate of #2778 , which is incorrectly flagged as "need: repro steps" right now as @huyph here and @fabian-dev in the linked issue have produced a repro sample.

  4. added 5 commits that reference this issue on Mar 19, 2017
    f1e27db
    1e72de0
    055a4b7
    58299dd
    8ab3954
  5. added a commit that references this issue on Mar 20, 2017
    9cda847
  6. angular-automatic-lock-bot commented on Sep 6, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  7. locked and limited conversation to collaborators on Sep 6, 2019
  8. added a commit that references this issue on May 29, 2026
    ddb80a8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenteffort1: easy (hours)type: bug/fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions