Skip to content

Fail with error & stack trace in asynchronous code #529

@stevecj

Description

@stevecj

When an error is thrown from asynchronous code, Jasmine currently has no way of knowing that it happened, skipping subsequent stages (e.g. "it" following error in "beforeEach") and reporting a trace.

As a workaround, I have written helper code to catch and record the error from a function execution so that it can be re-thrown from an "afterEach" block. This solution at least gives a failure and a stack trace, but still leaves a lot to be desired.

For my partial workaround, see the "asyncStep" and "getCaptureAsyncError" functions in https://github.com/stevecj/headway/blob/master/spec/support/userContextExt.js . To see how those are used, see https://github.com/stevecj/headway/blob/master/spec/indexedDbAdapterSpec.js .

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions