Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR [karma]: { inspect: [Function: inspect] } #3764

Closed
charafsalmi opened this issue Feb 17, 2022 · 5 comments
Closed

ERROR [karma]: { inspect: [Function: inspect] } #3764

charafsalmi opened this issue Feb 17, 2022 · 5 comments

Comments

@charafsalmi
Copy link

Hi,

On an angular project, the test stops with only this error.

17 02 2022 10:33:56.251:ERROR [karma]: { inspect: [Function: inspect] }
17 02 2022 10:33:56.252:DEBUG [launcher]: Disconnecting all browsers
17 02 2022 10:33:56.541:DEBUG [launcher]: Process Chrome exited with code 0
17 02 2022 10:33:56.541:DEBUG [temp-dir]: Cleaning temp dir C:\Users\---\AppData\Local\Temp\karma-11132084
17 02 2022 10:33:56.658:DEBUG [launcher]: Finished all browsers

Using "karma": "^2.0.2", as a devDependency on this angular project. No single run is set to true, as well as log level set to debug. On a windows 10 environment. NG Code 9.1.12, Jasmine ^2.8.17 .

Is there a way to have more verbosity ?

Thank you.

@charafsalmi
Copy link
Author

charafsalmi commented Feb 17, 2022

After a huge investigation, I ended up locating the issue as coming from karma/lib/server.js line 355 on my version :

    processWrapper.on('uncaughtException', (error) => {
      this.log.error(error)
    })

No explicit log or trace here, unfortunately.

On master, it points to a more verbose code :

this.log.error(`UncaughtException: ${error.stack || error.message || String(error)}`)

@charafsalmi
Copy link
Author

charafsalmi commented Feb 17, 2022

The issue is caused by an insecure test in webpack-dev-middleware@3.7.2/lib/util.js:131 :
if (req.headers.range) {
https://github.com/webpack/webpack-dev-middleware/blob/68ae47b1838dbd08f83b7e10099a0eaebdc311e1/lib/util.js#L131

If req.headers is falsy, this whole line causes an uncaughtException without any further explanation.

I am still not sure why it is falsy. Any proposition could help.
image

@devoto13
Copy link
Collaborator

I have a vague memory of something like this being fixed some long time ago. IIRC the problem was that some Node version has made req.headers non-enumerable as a result code like { ...req } stopped copying the request headers somewhere in Angular CLI plugin for karma, which caused this problem and was then fixed.

You seem to be using quite old versions, consider updating to the newer versions.

@devoto13
Copy link
Collaborator

Here are some refs: nodejs/node#36550, #3588, angular/angular-cli#19644

@devoto13
Copy link
Collaborator

Hope you were able to resolve your problem by now.
Closing as a stale support request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants