Description
Bug Report or Feature Request (mark with an x
)
- [X] bug report -> please search issues before submitting
- [ ] feature request
Command (mark with an x
)
- [ ] new
- [ ] build
- [ ] serve
- [X] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Versions
Angular CLI: 1.7.4
Node: 8.9.4
OS: darwin x64
Angular: 5.2.4
Repro steps
When running karma tests, stack traces are hidden when running via the following, unless --source-map=false is specified, however then the line numbers are incorrect:
ng test --config karma.conf.js
The log given by the failure
Stack trace in the console running karma using Chrome:
[object ErrorEvent] thrown
Stack trace in the Chrome browser console:
Failed to load ng:///DynamicTestModule/ShiftDetailCellComponent.ngfactory.js: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. (anonymous) @ zone.js:2956 polyfills.bundle.js:10484 Uncaught DOMException: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'ng:///DynamicTestModule/ShiftDetailCellComponent.ngfactory.js'. at http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/dist/zone.js:2956:1 at XMLHttpRequest.proto.(anonymous function) [as send] (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/dist/zone.js:1372:1)
CORS errors due to the mapping issues.
Desired functionality
The recently released version of source-map-support now catches the CORS errors and produces the correct stack trace as one would expect. See:
evanw/node-source-map-support#222
Mention any other details that might be useful
I'm assuming there has to be a big report on this somewhere, but I couldn't find it. There are similar issues under other projects as people have attempted to get to the root of this issue. One of those is:
As mentioned in my post here, I have confirmed that if I delete the bundled version of source-map-support and install the latest as a peer dependency, the issue is resolved. I'm not sure if there are any other issues that may result from a minor version bump and I haven't ran through all of the test suite for @angular/cli to verify yet, but this one issue does appear to be resolved by the new rev.
It didn't appear that source-map-support is still used in 6.0.X of the CLI, so not sure if this is even an issue with newer versions of the CLI. But if this can be packed for us to get a 1.7.5 version of the CLI, that would rock for those of us that want to migrate to a newer rev, but can't yet do so.
Thanks!