Skip to content

Silent errors in test.ts #2640

Closed
Closed

Description

@renehamburger

I'm using angular-cli@1.0.0-beta.16, node@6.5.0 and karma@1.2.0 (on OS X El Capitan).

When an exception is thrown while the spec files and their dependencies are loaded in test.ts, the output __karma__.error() is barely helpful. In Chrome only 'ERROR' is printed to the node console and it's close to impossible to break on such a caught exception due to too many false positives. PhantomJS prints out a error stack but not the error message.

It would be great if you could log the error before re-throwing it.

In my case, @ngrx/effects@1.1.1 wasn't compatible with @angular@2.0.1, which was difficult to spot without sufficient error logging.

Activity

  1. anton-107 commented on Oct 14, 2016

    @anton-107

    @renehamburger how did you find the error? Also a bit stuck on this, hints on how to tackle these type of issues would be helpful

  2. renehamburger commented on Oct 17, 2016

    @renehamburger
    Author

    You could add your own error logging by changing src/test.ts line 32 from

      .then(context => context.keys().map(context))

    to

      .then(context => {
        try {
          return context.keys().map(context);
        } catch (e) {
          console.error(e.message, e.stack);
          throw e;
        }
      })

    The error stack would refer to the bundled file though, which would make it less helpful. But the error message may be all you need to pinpoint the issue.

  3. filipesilva commented on Oct 17, 2016

    @filipesilva
    Contributor

    @renehamburger would you be interested in submitting a PR with this change? I'd be happy to review it, but would require you to give a short example/repro step of how the reported error changed.

  4. added
    P5The team acknowledges the request but does not plan to address it, it remains open for discussion
    on Oct 17, 2016
  5. added 4 commits that reference this issue on Oct 19, 2016
    ec2e549
    943839a
    a4d52be
    1bb49f5
  6. added a commit that references this issue on Oct 28, 2016
    f09439c
  7. added a commit that references this issue on Feb 9, 2017
    2cc2c40
  8. 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.

  9. locked and limited conversation to collaborators on Sep 6, 2019
  10. added a commit that references this issue on May 29, 2026
    03aeebc
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

    P5The team acknowledges the request but does not plan to address it, it remains open for discussion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions