Angular 6 Unit Tests: An error was thrown in afterAll\nReferenceError: Can't find variable: $...

Discussão em 'Angular' iniciado por Oisin, Abril 25, 2025.

  1. Oisin

    Oisin Guest

    When running my unit tests, from time to time, even if they pass, at the end of all the tests running, I will get the following error.

    On my Jenkins CI build running PhantomJS:

    .PhantomJS 2.1.1 (Linux 0.0.0) ERROR
    {
    "message": "An error was thrown in afterAll\nReferenceError: Can't find variable: $ thrown",
    "str": "An error was thrown in afterAll\nReferenceError: Can't find variable: $ thrown"
    }


    Or on Chrome:

    Chrome 67.0.3396 (Windows 7 0.0.0) ERROR
    {
    "message": "An error was thrown in afterAll\n[object ErrorEvent] thrown",
    "str": "An error was thrown in afterAll\n[object ErrorEvent] thrown"
    }


    I also have really unreliable tests, without changing anything some times they would succeed and other times the same tests would fail, so I knew something weird was going on.

    Continue reading...

Compartilhe esta Página