Karma in IntelliJ: Test framework quit unexpectedly [closed] - javascript

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
Searched for this error and nothing useful, so posting here.
I have a unit test for my Angular app and when I run it or debug it, it completes successfully. When I run code coverage, I get
13 11 2019 13:01:48.249:ERROR [karma-server]: TypeError: Cannot read property 'indexOf' of undefined
at Object.exports.arrayRemove (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\helper.js:109:26)
at _reporters.forEach (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\reporters\multi.js:15:50)
at Array.forEach (<anonymous>)
at MultiReporter.removeAdapter (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\reporters\multi.js:15:21)
at C:\Users\thehl\.IntelliJIdea2019.2\config\plugins\js-karma\js_reporter\karma-intellij\lib\intellijReporter.js:83:25
at Array.forEach (<anonymous>)
at C:\Users\thehl\.IntelliJIdea2019.2\config\plugins\js-karma\js_reporter\karma-intellij\lib\intellijReporter.js:81:33
at process._tickCallback (internal/process/next_tick.js:61:11)
13 11 2019 13:01:48.626:ERROR [karma-server]: TypeError: Cannot read property 'push' of undefined
at _reporters.forEach (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\reporters\multi.js:11:61)
at Array.forEach (<anonymous>)
at MultiReporter.addAdapter (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\reporters\multi.js:11:21)
at Server.<anonymous> (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\middleware\runner.js:41:18)
at Object.onceWrapper (events.js:277:13)
at Server.emit (events.js:194:15)
at Executor.schedule (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\executor.js:30:20)
at C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\middleware\runner.js:92:22
at tryCatcher (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:547:31)
at Promise._settlePromise (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromise0 (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:729:18)
at Promise._fulfill (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:673:18)
at Promise._resolveCallback (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:466:57)
at Promise._settlePromiseFromHandler (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:559:17)
Cannot read property 'success' of undefined
TypeError: Cannot read property 'success' of undefined
at TestCommand.runSingleTarget (C:\casenet\sources\provider-portal\portal-client\node_modules\#angular\cli\models\packages\angular\cli\models\architect-command.ts:242:21)
In addition, I get this in the Test Run window:
"C:\Program Files\nodejs\node.exe" C:\Users\thehl\.IntelliJIdea2019.2\config\plugins\js-karma\js_reporter\karma-intellij\lib\intellijRunner.js --serverPort=9876 --protocol=http: --urlRoot=/ "--testName=^COMPONENT/CLIENT -> DynamicInputComponent "
C:\Users\thehl\.IntelliJIdea2019.2\config\plugins\js-karma\js_reporter\karma-intellij\lib\intellijRunner.js:60
throw e;
^
Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:111:27)
I tried a full reboot and upgrading everything that said karma to the current version.
Have no idea where to even start debugging this.

Problem was caused by a recent change using karma-parallel. We broke up our unit tests to run in 4 separate threads with 4 separate web browsers.
I pulled all the references and definitions for karma-parallel from the package.json and from karma.conf.js. Unit tests work fine now within IntelliJ.
I'm simply going to have to roll this back every time I want to do this from now on.

Related

Error in backblaze b2 axiosRetry is not a function [duplicate]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 15 hours ago.
Improve this question
I am working on a next js 13 application in which I am making an image upload service through the formidable package and the backblaze b2 object storage service, I get this error after starting my application in next js, it worked fine but I've been getting this error for a while now, I've already tried uninstalling the node modules and installing the latest versions of the npm dependencies.
error stacktrace
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
./node_modules/formidable/src/Formidable.js
./node_modules/formidable/src/index.js
./controllers/uploadController.js
./controllers/productController.js
./app/page.jsx
warn - Fast Refresh had to perform a full reload due to a runtime error.
error - node_modules\backblaze-b2\lib\b2.js (24:4) # axiosRetry
error - TypeError: axiosRetry is not a function
at new B2 (webpack-internal:///(sc_server)/./node_modules/backblaze-b2/lib/b2.js:22:8)
at eval (webpack-internal:///(sc_server)/./lib/storageB2.js:8:18)
at (sc_server)/./lib/storageB2.js (C:\Users\fxliv\OneDrive\Escritorio\tuganga\.next\server\app\page.js:1005:1)
at __webpack_require__ (C:\Users\fxliv\OneDrive\Escritorio\tuganga\.next\server\webpack-runtime.js:33:43)
at eval (webpack-internal:///(sc_server)/./controllers/uploadController.js:5:72)
at (sc_server)/./controllers/uploadController.js (C:\Users\fxliv\OneDrive\Escritorio\tuganga\.next\server\app\page.js:983:1)
at __webpack_require__ (C:\Users\fxliv\OneDrive\Escritorio\tuganga\.next\server\webpack-runtime.js:33:43)
at eval (webpack-internal:///(sc_server)/./controllers/productController.js:9:75)
at (sc_server)/./controllers/productController.js (C:\Users\fxliv\OneDrive\Escritorio\tuganga\.next\server\app\page.js:972:1)
at __webpack_require__ (C:\Users\fxliv\OneDrive\Escritorio\tuganga\.next\server\webpack-runtime.js:33:43) {
type: 'TypeError',
page: '/'
}
null
I need someone to help me to continue working on my project, thanks!!

Javascript stack trace while running jest test VS stack trace while running an actual app

I am trying to get a stack trace during run time for logging purposes in a React app.
I am doing it by calling:
let stackTrace = new Error().stack;
When testing with Jest, I got a stack trace like I expected - a trace with file names, method names and line numbers. Example:
Error
at Object.it (C:\Users\somePath\Logger.test.js:80:19)
at Object.asyncFn (C:\Users\somePath\jasmine-async.js:68:30)
at resolve (C:\Users\somePath\queueRunner.js:38:12)
...
Based on what I got, I filtered the first line which was always the method which did the logging itself, while I wanted the calling context, and that's why the first line is Object.it which is the Jest test.
After that I tried testing it by actually running a react app and sending a message to a backend running on my localhost. The stack trace I got looks different:
Error
at tryCatch (http://localhost:3000/static/js/bundle.js:101275:40)
at Generator.invoke [as _invoke] (http://localhost:3000/static/js/bundle.js:101509:22)
at Generator.prototype. [as next] (http://localhost:3000/static/js/bundle.js:101327:21)
...
How can I get a stack trace similar to the one I got on the Jest test, so when someone looks on it, he can view a normal stack trace?
EDIT:
After updating my scripts, I now see a better trace in terms of the name of the method who actually logged the error. It looks like this:
at onBlur (http://localhost:3000/static/js/main.chunk.js:538:82)
at HTMLUnknownElement.callCallback (http://localhost:3000/static/js/1.chunk.js:51650:18)
However, is there also a way to get the name of the file where it happened in the original code instead of "http://localhost:3000/static/js/main.chunk.js:538:82"?

Jest - TypeError: Cannot read property 'fn' of undefined

Out of nowhere, I'm having an issue when running certain Jest tests:
Summary of all failing tests
FAIL server/controllers/voice/settings/__tests__/voice.settings.controller.test.js
● Test suite failed to run
TypeError: Cannot read property 'fn' of undefined
at Runtime._createJestObjectFor (node_modules/jest-runner/node_modules/jest-runtime/build/index.js:734:35)
at handle (node_modules/worker-farm/lib/child/index.js:44:8)
at process.<anonymous> (node_modules/worker-farm/lib/child/index.js:51:3)
at emitTwo (events.js:126:13)
at process.emit (events.js:214:7)
I saw that someone had the same problem here (https://github.com/facebook/jest/issues/5058) but I'm not sure if it ever got resolved. I tried removing node_modules and reinstalling but that didn't fix it. Wondering if anyone else has had the same error before and how it got resolved?
I got the same issue in my react app.So i added my jest setup.js file to
global.jQuery = require('jquery');
after that test worked fine
So this error actually came up since I was using node v8.9.3. After downgrading back to v6.11.1, this issue went away.

GulpUglifyError: unable to minify JavaScript (es6)

I have a problem with my gulp code.
Every time I try to make a dist file using gulp an error appears.
Something with the GulpUglify tool. (I'm still fairly new to using npm so maybe I did something wrong with the installation. If you think that is the case please explain the exact steps I have to take so that it doesn't go wrong again.
I have tried to find a solution but none of them helped.
I am using es6 in my js code.
Here are some of the links I tried.
(if you need any more info please say so!)
How to minify ES6 functions with gulp-uglify? (this one doesnt have the same error as I do but it might have something to do with es6)
https://github.com/terinjokes/gulp-uglify/issues/249 (I tried to do something with this, but I'm new to gulp and I got my file from a friend so I could have a localhost)
https://github.com/terinjokes/gulp-uglify/issues/281 (etc)
Here is what shows up in the console.
throw er; // Unhandled 'error' event
^
GulpUglifyError: unable to minify JavaScript
at createError (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/gulp-uglify/lib/create-error.js:6:14)
at wrapper (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/lodash/_createHybrid.js:87:15)
at trycatch (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/gulp-uglify/minifier.js:26:12)
at DestroyableTransform.minify [as _transform] (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/gulp-uglify/minifier.js:79:19)
at DestroyableTransform.Transform._read (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/readable-stream/lib/_stream_transform.js:182:10)
at DestroyableTransform.Transform._write (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/readable-stream/lib/_stream_transform.js:170:83)
at doWrite (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/readable-stream/lib/_stream_writable.js:406:64)
at writeOrBuffer (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/readable-stream/lib/_stream_writable.js:395:5)
at DestroyableTransform.Writable.write (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/readable-stream/lib/_stream_writable.js:322:11)
at Readable.ondata (_stream_readable.js:642:20)
at Readable.emit (events.js:159:13)
at addChunk (_stream_readable.js:265:12)
at readableAddChunk (_stream_readable.js:252:11)
at Readable.push (_stream_readable.js:209:10)
at /Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/fork-stream/index.js:51:13
at classifier (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/ternary-stream/index.js:20:11)

run node in gvim :ReferenceError: range is not defined [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
My system : xp + gvim+node.js
I have open gvim to edit a javascript sentence ,the file has no name yet.
print(sum(range(1, 10)));
when i input
:w !node
I get the error outputs :
C:\WINDOWS\system32\cmd.exe /c ( node ^<C:\DOCUME~1\sanya\LOCALS~1\Temp\VIi8C.tmp)
print(sum(range(1, 10)));
^
ReferenceError: range is not defined
at [stdin]:1:11
at Object.<anonymous> ([stdin]-wrapper:6:22)
at Module._compile (module.js:456:26)
at evalScript (node.js:532:25)
at ReadStream.<anonymous> (node.js:154:11)
at ReadStream.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:920:16
at process._tickCallback (node.js:415:13)
shell returned 8
Hit any key to close this window...
How can i fix the error?
when i change the print(sum(range(1, 10))); into print("hallo world"); in gvim ,and input w ! node,i got the same output?
why in javasript window in eloquentjavascript.net/chapter1.html ,i can get right answer?
You must define the "range", "sum", and "print" functions.
Once you do that your JavaScript code will be executable by the node interpreter.
Also, the use of gvim is irrelevant here. Running that code from the command line will have the same results.

Categories