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 trace cleaning not happening when using Babel's async/await #1950

Closed
djanowski opened this issue Oct 29, 2015 · 3 comments
Closed

Stack trace cleaning not happening when using Babel's async/await #1950

djanowski opened this issue Oct 29, 2015 · 3 comments

Comments

@djanowski
Copy link

Test:

describe('foo', function() {
  it('bar', async function() {
    await bar();
  });
});

function bar() {
  return new Promise(function(resolve, reject) {
    reject(new Error('bar'));
  });
}
mocha --compilers js:babel/register foo_test.js 


  foo
    1) bar


  0 passing (194ms)
  1 failing

  1) foo bar:
     Error: bar
      at foo_test.js:9:12
      at new Promise (node_modules/babel/node_modules/babel-core/node_modules/core-js/modules/es6.promise.js:183:7)
      at bar (foo_test.js:8:10)
      at Context.callee$1$0$ (foo_test.js:3:11)
      at tryCatch (node_modules/babel/node_modules/babel-core/node_modules/regenerator/runtime.js:61:40)
      at GeneratorFunctionPrototype.invoke [as _invoke] (node_modules/babel/node_modules/babel-core/node_modules/regenerator/runtime.js:328:22)
      at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (node_modules/babel/node_modules/babel-core/node_modules/regenerator/runtime.js:94:21)
      at invoke (node_modules/babel/node_modules/babel-core/node_modules/regenerator/runtime.js:136:37)
      at callInvokeWithMethodAndArg (node_modules/babel/node_modules/babel-core/node_modules/regenerator/runtime.js:172:16)
      at previousPromise (node_modules/babel/node_modules/babel-core/node_modules/regenerator/runtime.js:194:19)
      at new Promise (node_modules/babel/node_modules/babel-core/node_modules/core-js/modules/es6.promise.js:183:7)
      at AsyncIterator.enqueue (node_modules/babel/node_modules/babel-core/node_modules/regenerator/runtime.js:193:13)
      at AsyncIterator.prototype.(anonymous function) [as next] (node_modules/babel/node_modules/babel-core/node_modules/regenerator/runtime.js:94:21)
      at Object.runtime.async (node_modules/babel/node_modules/babel-core/node_modules/regenerator/runtime.js:215:14)
      at Context.callee$1$0 (foo_test.js:2:13)
@danielstjules
Copy link
Contributor

The stack trace filtering no longer filters out anything but mocha's internal calls. This is expected behavior. To filter out lines from your own dependencies, try https://github.com/rstacruz/mocha-clean

@djanowski
Copy link
Author

I guess this confused me.

Thanks for your reply!

@danielstjules
Copy link
Contributor

Oops :) and sorry about that! Hopefully mocha-clean will be helpful

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

2 participants