compoundjs mocha tests failing on ubuntu server - node.js

My tests run fine in my OS X environment, but when I run them on my ubuntu (EC2) server, the tests fail with:
✖ 1 of 40 tests failed:
1) AccountController "before each" hook:
Error: done() invoked with non-Error: [object Object]
at CompoundServer.<anonymous> (/usr/lib/node_modules/mocha/lib/runnable.js:198:38)
at CompoundServer.EventEmitter.emit (events.js:95:17)
at CompoundServer.initCompound (/home/ubuntu/TeamCity/buildAgent/work/1d2dd0b199edbe3f/node_modules/compound/lib/compound.js:133:14)
at CompoundServer.initCompoundServer [as init] (/home/ubuntu/TeamCity/buildAgent/work/1d2dd0b199edbe3f/node_modules/compound/lib/server/compound.js:53:29)
at /home/ubuntu/TeamCity/buildAgent/work/1d2dd0b199edbe3f/node_modules/compound/lib/compound.js:62:18
at process._tickCallback (node.js:415:13)
All i'm doing is running mocha test/*. Could this possibly be caused by a difference in compoundjs or node.js? On my mac where it is working i'm on v0.8.22, on the ubuntu server it's v0.10.5. Likewise compound version on ubuntu is 1.1.7-1, while on mac (working) is 1.1.6.

Looks like an issue with the app being generated by a previous version of compound. Changing this line on my generated test
compound.on('ready', done);
to
compound.on('ready', function() {
done();
});
Fixed the problem.

Related

Jestjs tests fail in Gitlab CI

I'm trying to run Jest tests in Gitlab CI.
The tests succeed locally but when I run them on Gitlab CI I get the following error:
Test suite failed to run
ProcessTerminatedError: cancel after 2 retries!
at Farm.<anonymous> (node_modules/worker-farm/lib/farm.js:81:25)
at Array.forEach (native)
at Farm.<anonymous> (node_modules/worker-farm/lib/farm.js:75:36)
at ontimeout (timers.js:386:14)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)
A worker process has quit unexpectedly! Most likely this is an
initialization error.
error Command failed with exit code 1.
I tried to add the --runInBand option but this results in a segmentation fault. And I also tried the --maxWorkers option but this results in the same error. Any ideas how to resolve this issue?
I resolved this issue. The problem in my case was not Jest itself but with canvas-prebuilt I'm still not sure what the problem was but I replaced canvas-prebuilt with the canvas npm package and installed the required packages. Now everything works fine.

Mocha-allure-reporter not working with node js

I am facing issue when I run my tests with mocha-allure-reporter ,the tests are running successfully with mocha ,but mocha --reporter mocha-allure-reporter returns the following error
> notifications-api#1.0.0 test /app
> mocha --reporter mocha-allure-reporter
2016-11-15T06:13:26.762Z - info: Notification API up and running on port 4000
2016-11-15T06:13:26.773Z - error: Tue, 15 Nov 2016 06:13:26 GMT uncaughtException
2016-11-15T06:13:26.775Z - error: TypeError: test.currentRetry is not a function
at Runner.<anonymous> (/app/node_modules/mocha-allure-reporter/index.js:29:19)
at emitOne (events.js:77:13)
at Runner.emit (events.js:169:7)
at next (/app/node_modules/mocha/lib/runner.js:517:10)
at Runner.runTests (/app/node_modules/mocha/lib/runner.js:556:3)
at /app/node_modules/mocha/lib/runner.js:637:10
at next (/app/node_modules/mocha/lib/runner.js:283:14)
at Immediate._onImmediate (/app/node_modules/mocha/lib/runner.js:319:5)
at processImmediate [as _immediateCallback] (timers.js:383:17)
npm ERR! Test failed. See above for more details.
Can anyone help to fix this issue?
The issues can be resolved by updating your mocha to the latest version probably to v3 or above and allure reporter too. If the issue still persists regarding TypeError: test.currentRetry is not a function , please replace the line of code
if (!test.currentRetry()) {
with the following
if (typeof test.currentRetry !== "function" || !test.currentRetry()) {

Can't start my meteor app on a centos7 DO server

I just git cloned from Telescope's git repository and run meteor, but it can't start the app successfully. How to deal with this ? I've googled but I can't get a easy to follow solution.
=> Started proxy.
=> Started MongoDB. nova:rss: updating npm dependencies -- rss... Unexpected
mongo exit code null. Restarting.
/root/.meteor/packages/coffeescript/.1.0.17.1qmihgc++os+web.browser+web.cordova/plugin.compileCoffeescript.os/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:116
throw error;
^ Error: spawn ENOMEM
at errnoException (child_process.js:1011:11)
at ChildProcess.spawn (child_process.js:958:11)
at Object.exports.spawn (child_process.js:746:9)
at spawnMongod (/tools/runners/run-mongo.js:45:24)
at launchOneMongoAndWaitForReadyForInitiate (/tools/runners/run-mongo.js:468:12)
at launchMongo (/tools/runners/run-mongo.js:682:7)
at MongoRunner._startOrRestart (/tools/runners/run-mongo.js:789:19)
at [object Object]. (/tools/runners/run-mongo.js:857:14)
at runWithEnvironment (/tools/utils/fiber-helpers.js:112:21)

Node selenium-webdriver "Error: Timed out waiting for the WebDriver server at"

While following the instructions in the 'Getting Started' section of
the WebDriverJs documentation and after running this snippet from their site:
var driver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.chrome()).
build();
driver.get('http://www.google.com');
driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');
driver.findElement(webdriver.By.name('btnG')).click();
driver.wait(function() {
return driver.getTitle().then(function(title) {
return title === 'webdriver - Google Search';
});
}, 1000);
driver.quit();
I'm getting this error:
Error: Timed out waiting for the WebDriver server at http://XXX.XXX.X.XXX:60065/
at <anonymous>
at <anonymous>
at <anonymous>
at <anonymous>
at <anonymous>
at <anonymous>
at <anonymous>
at <anonymous>
at <anonymous>
at <anonymous>
==== async task ====
WebDriver.createSession()
I'm running OSX Mavericks using the mac32 version of ChromeDriver found here. The chromedriver executable is in my /usr/local/bin directory, and is accessible on my path.
One thing I notice is that when I run chromedriver from the command line, it runs on port 9515, while the node code is looking for it on 60065. However, there shouldn't be any extra configuration required for just running with the chromedriver.
Would anyone have any ideas on why I'm getting this error?
I was having this exact issue today and near as I can tell it's a bug with the current version of the selenium-webdriver package (2.41.0).
There is a bug filed with the Selenium project but I don't think the fix has made its way onto npm yet.
Downgrading to version 2.9.248307 of Chromedriver worked for me.
Based on #Andrej Kaurin comment:
You can set
directConnnect: true
in your protractor configuration.
When this is set, protractor connects directly with browser driver and selenium is not needed.
More details: https://github.com/angular/protractor/blob/master/docs/server-setup.md#connecting-directly-to-browser-drivers
For me what worked was being on version 78.0.33904.70 of ChromeDriver and then version of Chrome Browser 78.0.3904.87
Here is the link to get Chrome Driver:
http://chromedriver.storage.googleapis.com/index.html?path=78.0.3904.70/
How to check what version of chrome you have: https://support.chall.com/hc/en-us/articles/200336349-How-do-I-determine-what-version-of-Google-Chrome-I-m-using-
I had this error when using new firefox.Service Builder('/path/to/geckodriver'), this error disappeared when I added the path to geckodriver to the variable $PATH.

Node with Opa app crashes when trying to connect to unavailable CouchDB

I am working on Opa app using CouchDB as a database backend. When fetching a document with API function CouchDd.Document.get (API doc) and the DB server is down, my app crashed:
/opt/mlstate/lib/opa/stdlib/server.opp/serverNodeJsPackage.js:169
,(global.hasOwnProperty("toString") && global.toString || undefined)(e));}req.
^
TypeError: undefined is not a function
at ClientRequest.on_error (/opt/mlstate/lib/opa/stdlib/server.opp/serverNodeJsPackage.js:169:489)
at ClientRequest.EventEmitter.emit (events.js:88:17)
at Socket.socketErrorListener (http.js:1320:9)
at Socket.EventEmitter.emit (events.js:88:17)
at Socket._destroy.self.errorEmitted (net.js:329:14)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
and returns to shell prompt. I am running the app with ./myapp --nodb, because I do not use the build-in support for the MongoDB.
The CouchDb.Document.get function returns either {success: {FormatedJson: ...}} or {failure}. I expected that parsing the result for the {failure} is enough to catch all the network connection problems. What else should I do?
I am using Opa framework version 1.0.5 on OSX (11.4.0 Darwin) from the standard package on the Opa website, Node.js v0.8.3 and CouchDB 1.2.0.
This was a bug in 1.0.5, but it's been fixed already. You can get the sources for the fixed version here, but an official package hasn't been released yet.

Resources