Jestjs tests fail in Gitlab CI - jestjs

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.

Related

How can I complete the Sanity init while error during "resolving latest module versions" keeps appearing

When trying to init Sanity I keep getting this error during the "resolving latest module versions" step.
Error: connect ETIMEDOUT xxx.xx.xx.xx:xxx
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16)
I saw here something about specifying the pool variable in options. Without access to the referred file, what can I do to complete the init?
Apparently, this specific error was caused by the use of a VPN or Proxy. Turning it off fixed it for me.

NGCC failed error in Angular 11.x app when running npm run

I have an Angular 11.x app that I run using npm run start - this has worked fine for months but all of a sudden it is no longer running the command and I am getting the following errors, can anyone suggest how I fix this? I have tried the obvious ideas of deleting node_modules and reinstalling them using npm install but with no joy.
Below is the error I get after running npm run start - what have I done to break this :(
Compiling #angular/core : es2015 as esm2015
Error: Error on worker #1: TypeError: Cannot read property 'map' of undefined
at injectDependencies (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler/bundles/compiler.umd.js:6960:21)
at compileFactoryFunction (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler/bundles/compiler.umd.js:6888:61)
at Object.compileInjector (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler/bundles/compiler.umd.js:8106:22)
at NgModuleDecoratorHandler.compileFull (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/src/ngtsc/annotations/src/ng_module.js:427:44)
at _loop_2 (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/src/ngtsc/transform/src/compilation.js:595:39)
at NgccTraitCompiler.TraitCompiler.compile (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/src/ngtsc/transform/src/compilation.js:626:21)
at DecorationAnalyzer.compileFile (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/ngcc/src/analysis/decoration_analyzer.js:225:53)
at DecorationAnalyzer.analyzeProgram (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/ngcc/src/analysis/decoration_analyzer.js:164:45)
at Transformer.analyzeProgram (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/ngcc/src/packages/transformer.js:135:57)
at Transformer.transform (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/ngcc/src/packages/transformer.js:77:27)
at ClusterMaster.onWorkerMessage (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/ngcc/src/execution/cluster/master.js:195:27)
at /Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/ngcc/src/execution/cluster/master.js:55:95
at ClusterMaster.<anonymous> (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/ngcc/src/execution/cluster/master.js:293:57)
at step (/Users/zabius/Sites/abc-ui-ng4/node_modules/tslib/tslib.js:143:27)
at Object.next (/Users/zabius/Sites/abc-ui-ng4/node_modules/tslib/tslib.js:124:57)
at /Users/zabius/Sites/abc-ui-ng4/node_modules/tslib/tslib.js:117:75
at new Promise (<anonymous>)
at Object.__awaiter (/Users/zabius/Sites/abc-ui-ng4/node_modules/tslib/tslib.js:113:16)
at EventEmitter.<anonymous> (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular/compiler-cli/ngcc/src/execution/cluster/master.js:287:32)
at EventEmitter.emit (events.js:315:20)
An unhandled exception occurred: NGCC failed.
See "/private/var/folders/b2/1zfdxz293d944p_lxk9_ypz40000gn/T/ng-XQcM3b/angular-errors.log" for further details.
The error in the angular-errors.log file is as follows -
[error] Error: NGCC failed.
at NgccProcessor.process (/Users/zabius/Sites/abc-ui-ng4/node_modules/#ngtools/webpack/src/ngcc_processor.js:129:19)
at /Users/zabius/Sites/abc-ui-ng4/node_modules/#ngtools/webpack/src/angular_compiler_plugin.js:593:31
at SyncHook.eval [as call] (eval at create (/Users/zabius/Sites/abc-ui-ng4/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:19:10$
at SyncHook.lazyCompileHook (/Users/zabius/Sites/abc-ui-ng4/node_modules/webpack/node_modules/tapable/lib/Hook.js:154:20)
at Object.webpack [as webpackFactory] (/Users/zabius/Sites/abc-ui-ng4/node_modules/webpack/lib/webpack.js:55:30)
at createWebpack (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular-devkit/build-webpack/src/webpack-dev-server/index.js:21:36)
at Object.runWebpackDevServer (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular-devkit/build-webpack/src/webpack-dev-server/index.js:47:12)
at SwitchMapSubscriber.project (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular-devkit/build-angular/src/dev-server/index.js:209:32)
at SwitchMapSubscriber._next (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular-devkit/build-angular/node_modules/rxjs/internal/operators/swit$
at SwitchMapSubscriber.Subscriber.next (/Users/zabius/Sites/abc-ui-ng4/node_modules/#angular-devkit/build-angular/node_modules/rxjs/internal/Subs$
at /Users/zabius/Sites/abc-ui-ng4/node_modules/#angular-devkit/build-angular/node_modules/rxjs/internal/util/subscribeToPromise.js:7:24
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Versions :
npm -v 8.1.0
node -v 14.15.4
Using MacOS BigSur 11.5.2

Issue deploying to elastic beanstalk "50npm.sh failed"

I'm having an issue deploying some code to one of my environments.
Creating application version archive "app-aa68e-170213_103330".
Uploading PAS-API/app-aa68e-170213_103330.zip to S3. This may take a while.
Upload Complete.
INFO: Environment update is starting.
INFO: Deploying new version to instance(s).
ERROR: Failed to run npm install. Snapshot logs for more details.
ERROR: [Instance: i-0ee97a5c7bcab8d51] Command failed on instance. Return code: 1 Output: (TRUNCATED)..."/opt/elasticbeanstalk/containerfiles/ebnode.py", line 180, in npm_install
raise e
subprocess.CalledProcessError: Command '['/opt/elasticbeanstalk/node-install/node-v4.4.6-linux-x64/bin/npm', '--production', 'install']' returned non-zero exit status 1.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/50npm.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
ERROR: Unsuccessful command execution on instance id(s) 'i-0ee97a5c7bcab8d51'. Aborting the operation.
It seems that the deployment is failing when npm install is running on the server.
When I checked the package.json it seemed some of the deps were added as a tarball instead of a version number, meaning that when it installed and saved it looked like this:
"basic-auth": "https://registry.npmjs.org/basic-auth/-/basic-auth-1.0.4.tgz"
Rather than
"basic-auth": "^1.1.0",
This was failing on npm install on the eb instance, it looks like it works now.
If it was OK before and you didn't change deployment settings, you can reboot the instance and it usually solve the problem.

Error: The hook `orm` is taking too long to load

whenever trying to lifting sails it gives me the hookTimeout error every time.
While for the same configuration settings it's perfectly running on other systems.
using Ubuntu 16.0.4 and Manjaro
nodejs version 7.4.0
sails version 0.12.11
Mongodb version 3.4.1
the complete error report is like this.
info: Starting app...
error: Grunt :: /usr/local/lib/ruby/gems/2.4.0/gems/sass-3.4.23/lib/sass/util.rb:1109: warning: constant ::Fixnum is deprecated
error: Grunt :: /usr/local/lib/ruby/gems/2.4.0/gems/sass-3.4.23/lib/sass/util.rb:1109: warning: constant ::Fixnum is deprecated
error: Error: The hook orm is taking too long to load.
Make sure it is triggering its initialize() callback, or else set `sails.config.orm._hookTimeout to a higher value (currently 60000)
at Timeout.tooLong [as _onTimeout] (/home/navalk/PV/provakil/sails/node_modules/sails/lib/app/private/loadHooks.js:92:21)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)
Try do cut your last created/changed model.
If won't help, try to cut one by one and move to another folder.
You will then find if it is issue with some of your models or really with sails.
Try increasing hook timeout in local.js
hookTimeout : 30000,

compoundjs mocha tests failing on ubuntu server

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.

Resources