taskworld / test-bed

:factory: Development test runner for webpack to improve TDD experience. Runs only specs affected by code change. Serve test files from memory. For large project with hundreds of test files.
33 stars 5 forks source link

devtool wrong traceback #12

Open kwek opened 7 years ago

kwek commented 7 years ago

Hello, first of all great work on this project. This makes development much easier than the regular karma runner.

However I noticed console tracebacks are not displayed correctly in the browser as a test result. For example, I see something like this. Notice that it displays test.bundle.js:4652 which is unclear where it came from.

Error: bier
    at CustomQueryFilterOverlay.render (eval at <anonymous> (test-assets/test.bundle.js:4652:1), <anonymous>:52:10)
    at eval (eval at <anonymous> (test-assets/test.bundle.js:4817:1), <anonymous>:796:21)
    at measureLifeCyclePerf (eval at <anonymous> (test-assets/test.bundle.js:4817:1), <anonymous>:75:12)

I reduced the problem to the line config.devtool = '#cheap-eval-module-source-map' in test-bed/createServer.js

If i change the devtool to 'cheap-module-source-map', then the backtrace looks like this. Now its clear it came from CustomQueryFilterOverlay.js:41

Error: bier
    at CustomQueryFilterOverlay.render (test-assets/webpack:/basesoft/web/core/modules/overlays/CustomQueryFilterOverlay.js:41:1)
    at test-assets/webpack:/~/react-dom/lib/ReactCompositeComponent.js:796:1

Should we make the devtool configurable or could this be an issue in our setup maybe. Any help is appreciated and i'm happy to make a PR if needed.

dtinth commented 7 years ago

Thanks for the PR.

I agree that we should make the devtool configurable.

Following create-react-app’s footsteps, we can change the default devtool to 'eval' for best performance and debugging experience. Maybe if the configuration already includes devtool, we can leave that alone (not forcing devtool to be '#cheap-eval-module-source-map').

kwek commented 7 years ago

PR at https://github.com/taskworld/test-bed/pull/13