intern
intern copied to clipboard
Better stack traces when using webpack
Currently intern remaps stack traces when using transpiled code, which is great. When using WebPack though, the file resolution is a bit "ugly" and could be improved. For example, here is an example assertion error which has been remapped:
AssertionError: Alternative Facts!: expected true to be false
at Function.assert.isFalse </Users/kitsonk/github/maya-healthcare-sow6/_build/tests/unit/webpack:/~/chai/lib/chai/interface/assert.js:370:0>
at Test.Post truth era [as test] </Users/kitsonk/github/maya-healthcare-sow6/_build/tests/unit/webpack:/tests/unit/mixins/StoreMixin.ts:71:9>
at <node_modules/intern/lib/Test.js:191:24>
at <node_modules/intern/browser_modules/dojo/Promise.ts:393:15>
at runCallbacks <node_modules/intern/browser_modules/dojo/Promise.ts:11:11>
at <node_modules/intern/browser_modules/dojo/Promise.ts:317:4>
at run <node_modules/intern/browser_modules/dojo/Promise.ts:237:7>
at <node_modules/intern/browser_modules/dojo/nextTick.ts:44:3>
at _combinedTickCallback <internal/process/next_tick.js:67:7>
at process._tickCallback <internal/process/next_tick.js:98:9>
Where this could be improved to be:
AssertionError: Alternative Facts!: expected true to be false
at Function.assert.isFalse <webpack:/~/chai/lib/chai/interface/assert.js:370:0>
at Test.Post truth era [as test] <webpack:/tests/unit/mixins/StoreMixin.ts:71:9>
at <node_modules/intern/lib/Test.js:191:24>
at <node_modules/intern/browser_modules/dojo/Promise.ts:393:15>
at runCallbacks <node_modules/intern/browser_modules/dojo/Promise.ts:11:11>
at <node_modules/intern/browser_modules/dojo/Promise.ts:317:4>
at run <node_modules/intern/browser_modules/dojo/Promise.ts:237:7>
at <node_modules/intern/browser_modules/dojo/nextTick.ts:44:3>
at _combinedTickCallback <internal/process/next_tick.js:67:7>
at process._tickCallback <internal/process/next_tick.js:98:9>
Essentially when the source is a webpack URL, that should be used instead of being joined onto the source file path of the WebPack chunk.
Updates should be made in error formatter (src/core/lib/common/ErrorFormatter and src/core/lib/node/ErrorFormatter).