Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stack can be undefined on uncaught exceptions causing TerminalReporter to throw #214

Open
catdad opened this issue Nov 15, 2022 · 0 comments

Comments

@catdad
Copy link

catdad commented Nov 15, 2022

Sometimes (it is unclear to me when) uncaught exceptions that fail tests will not include a stack property. When this happens, the TerminalReporter throws an error. Worse, any reporters registered after the TerminalReporter are not notified of this failure, which is pretty bad.

My tests that repro this issue

describe('my tests', function() {
    it('throws async error', function () {
        setTimeout(function () {
            throw new Error('I am the error');
        }, 5);
    });

    it('just waits a bunch', function(done) {
        setTimeout(function () {
            done();
        }, 100);
    });
});

This throws an error here:

logStackLines(spec._depth, spec.failedExpectations[i].stack.split("\n"));

This should be an easy fix...

if (self.showStack && spec.failedExpectations[i].stack){
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant