intern icon indicating copy to clipboard operation
intern copied to clipboard

Better stack traces when using webpack

Open kitsonk opened this issue 8 years ago • 1 comments

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.

kitsonk avatar Mar 24 '17 12:03 kitsonk

Updates should be made in error formatter (src/core/lib/common/ErrorFormatter and src/core/lib/node/ErrorFormatter).

jason0x43 avatar Feb 21 '20 19:02 jason0x43