I understand that mocha uses superagent under the hood, but how does it work when I haven't started a local server? Does mocha start a server by itself and send http requests to it or am I misunderstanding how mocha works in the first place?
For clarity, I checked and currently I do not have a local server running and that's when I got a bit confused as to how mocha tests work under the hood
Mocha runs JavaScript code with Node, just like your npm scripts which runs your local server. You just don't see it on the console like you do when you enter npm run debug or whatever your script is. So under the hood it's just Node running the JavaScript.
Which is why you don't need to start a server because it's already running while tests are executing. You just aren't seeing the console logs you're use to, except for what Mocha prints of course. See their page for more details.
Related
I have some code in my hooks that runs while were running tests in Browserstack to update test results etc.
The line of code in question:
global.driver.execute(`browserstack_executor: ${JSON.stringify(result)}`)
The problem with having it running in the hooks is that it'll run even if we're running the tests locally.
This produces the error (which makes sense):
ERROR webdriver: Request failed with status 405 due to unknown method: Method is not implemented
Obviously we don't want this running at all when we're running the tests locally, so I wrapped it in a try catch. The issue is that the error is actually being thrown after the try catch so doesn't actually suppress the error at all.
I want to try and wrap this in an if statement that says "If we're running tests in Browserstack then..." however I'm unsure how to write this, or if anything like this exists at all.
Any help or other suggestions would be appreciated!
I have a node.js server which runs a child process on the server when the user requests.
This child process is managed by npm package 'child_process' and running a 'Puppeteer' script.
The whole process works as expected on local.
The problem is when I check it on the server, and then - the process IS executed and logs are printed, BUT I don't see the browser of puppeteer even though it's in headless false.
The server uses IIS and I suspect that maybe it's related.
p.s. I also tried the npm package 'execa' for the execution of the child process, and nothing changed.
Any ideas?
Thanks
After importing snapsvg-cjs in .ts file(in Dojo2 Project) intern test case got stuck after executing all test cases.
Any idea what I am doing wrong?
When Intern is stuck open after test cases have finished, it typically means that a file or socket is still open. Intern is done, but the Node process won't shut down while handles are still open. This can happen if, say, an asynchronous process were started in a test without returning a Promise.
One way to diagnose what's preventing the Intern process from exiting is to run it with wtfnode. When wtfnode is used to run a node program and the program is manually killed (like with with ctrl-c), wftnode will display any open resources. Run Intern with wtfnode, ctrl-c when it appears to be hung, then see what's still open.
I have a Meteor (Node.js) app in production that keeps hanging unexplainably in production. I have put a number of log statements in the code, so I can see that it hangs on a certain method.
My question is if there are any other tools other that the console log that might give me insight into the resource consumption of a Node.js app. Something that might tell me why the app is hanging.
The method on which the server hangs is a method that uses a geocluster and geolib NPM. It usually happens after a method where the Facebook-node-SDK is called.
I am thinking that there might be memory consumption from the calls to the geo npm, or open http connections from the facebook-node-sdk?
Please let me know if there is more information that I can provide. Any help would be appreciated.
You could try node-inspector and pass environment run vars to meteor via NODE_OPTIONS='--debug-brk' meteor run and try your luck there.
(2017 update: there was an answer here referencing Kadira (kadira.io) however this service is no more.. sad).
You may also try the built-in NodeJS devtools available since 6.3. If you read the node-inspector github repo, you can see a blog post referenced there to get started:
https://medium.com/#paul_irish/debugging-node-js-nightlies-with-chrome-devtools-7c4a1b95ae27#.pmqejrn8q
You can try Webstorm, version 9 has meteor support, debugging included.
I am creating Qunit tests which are running on grunt server. In the test when I am trying to use "console.log" to log some output to the console, it is not printing anything in the console.
Currently I am able to use only OK to perform the assertions.
Please give your inputs.
If you are using the qunit task in grunt, you need to start the task with --debug (i.e. grunt test --debug). You will then see phantom logs printing out your console logs in the following format:
[D] ["phantomjs","console","MIXPANEL PEOPLE REQUEST (QUEUED, PENDING
IDENTIFY):"]
See documentation