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

Broken Source Maps or Stack Traces for async functions after upgrading from 3.1.0 to 3.1.1 #2528

Closed
donaldpipowitch opened this issue Oct 10, 2016 · 10 comments
Labels
area: browser browser-specific type: bug a defect, confirmed by a maintainer

Comments

@donaldpipowitch
Copy link

donaldpipowitch commented Oct 10, 2016

Given a test like this:

import 'babel-polyfill';
import expect from 'expect';

describe('test my code', () => {
  it('should show my app', async (): Promise<any> => {
    expect(2).toBe(1);
  });
});

3.1.1 shows:

ERROR: 'Unhandled promise rejection', TypeError{stack: 'fail@http://localhost:9876/absolute/Users/foo/Workspace/project/node_modules/mocha/mocha.js?60c338ed8db7987f07880c121c83fed2648782f6:4726:6

And also:

10 10 2016 15:35:06.809:WARN [PhantomJS 2.1.1 (Mac OS X 0.0.0)]: Disconnected (1 times), because no message in 10000 ms.
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
      Disconnected, because no message in 10000 ms.

3.1.0 correctly reports an error with a correct stack trace and isn't disconnected from PhantomJS. (I guess the promise rejection is handled correctly.)

Note that I use an async function here. (In my real test I also await something, but it is not necessary to do that to reproduce the error.

Maybe it was introduced by fixing #1417?

@boneskull
Copy link
Member

I'm going to guess this is Karma, karma-mocha, karma-babel-preprocessor and karma-phantomjs-launcher... but really could use some more info

@boneskull
Copy link
Member

wait typescript?

@boneskull boneskull added unconfirmed status: waiting for author waiting on response from OP - more information needed labels Oct 11, 2016
@donaldpipowitch
Copy link
Author

Yes to everything, except karma-babel-preprocessor ;)

@boneskull boneskull added confirmed and removed status: waiting for author waiting on response from OP - more information needed unconfirmed labels Oct 11, 2016
@boneskull
Copy link
Member

I can trivially reproduce with just karma, karma-mocha and karma-phantomjs-launcher (phantomjs 2.1.1)

@boneskull
Copy link
Member

okay

@boneskull
Copy link
Member

but not 100% that this is a bug yet

@boneskull
Copy link
Member

okay, yeah this looks like a failure to properly handle the rejection. fwiw, the previous behavior was also incorrect, even though mocha was able to handle it.

@boneskull boneskull added type: bug a defect, confirmed by a maintainer area: browser browser-specific labels Oct 11, 2016
@boneskull
Copy link
Member

alright, I got something

boneskull added a commit that referenced this issue Oct 11, 2016
I have no idea what's causing the error to have a non-writable `stack` property. ¯\_(ツ)_/¯
boneskull added a commit that referenced this issue Oct 11, 2016
I have no idea what's causing the error to have a non-writable `stack` property. ¯\_(ツ)_/¯
@donaldpipowitch
Copy link
Author

Cool! Thank you for the quick response.

@boneskull
Copy link
Member

np. we don't have the greatest browser coverage, so this is bound to happen from time to time.

published as v3.1.2

sgilroy pushed a commit to TwineHealth/mocha that referenced this issue Feb 27, 2019
I have no idea what's causing the error to have a non-writable `stack` property. ¯\_(ツ)_/¯
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: browser browser-specific type: bug a defect, confirmed by a maintainer
Projects
None yet
Development

No branches or pull requests

2 participants