karma-runner / karma-runner/karma
Uncaught (in promise) Error log doesn't show in terminal
- Dominant language
- JavaScript
- Stars
- 12k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
If I open the web console I can see:
```
Uncaught (in promise) Error: some error
at _callee$ (test.test.jsx:68)
at tryCatch (runtime.js:63)
at Generator.invoke [as _invoke] (runtime.js:294)
at Generator.eval [as next] (runtime.js:119)
at asyncGeneratorStep (asyncToGenerator.js:7)
at _next (asyncToGenerator.js:29)
at eval (asyncToGenerator.js:36)
at new Promise ()
at eval (asyncToGenerator.js:25)
at eval (test.test.jsx:76)
```
But this error doesn't appear in my terminal when running karma. Other console.error() calls do, just not this one.
I'm using webpack with babel:
```
module: {
rules: [{
test: /\.jsx?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: ['@babel/plugin-transform-runtime']
}
}
}]
}
```
I tried modifying console.error or add window.onerror at the top of the file but that didn't help
The code that triggers this error:
```
describe('test', () => {
it('test', async () => {
;(async () => {
console.error('this logs')
throw Error('some error') // this doesn't log anything, fails silently
console.log(`this doesnt log`)
})()
await new Promise(r => setTimeout(r, 5000))
})
})
```
If I remove babel I get a different error in browser console but still nothing in karma terminal:
```
Uncaught (in promise) Error: some error
at eval (test.test.js:6)
at Context.eval (test.test.js:8)
at callFn (mocha.js?b563f8e54f57e1182e401297329e3b0440f8f358:13124)
at Test$4.Runnable$3.run (mocha.js?b563f8e54f57e1182e401297329e3b0440f8f358:13112)
at Runner.runTest (mocha.js?b563f8e54f57e1182e401297329e3b0440f8f358:14657)
at mocha.js?b563f8e54f57e1182e401297329e3b0440f8f358:14780
at next (mocha.js?b563f8e54f57e1182e401297329e3b0440f8f358:14572)
at mocha.js?b563f8e54f57e1182e401297329e3b0440f8f358:14582
at next (mocha.js?b563f8e54f57e1182e401297329e3b0440f8f358:14465)
at mocha.js?b563f8e54f57e1182e401297329e3b0440f8f358:14550
```
Contributor guide
Assessment
This issue has not been assessed yet.