Running Jest Debug on Windows – SyntaxError: missing ) after argument list

I’m using NestJS and the regular tests works smooth even in my Windows machine. However, when I tried running the debugging mode tests, especially since I’m trying to debug a memory leak, I get this error:

basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^ SyntaxError: missing ) after argument list

I traced some of the discussions in Github like this:

https://github.com/facebook/jest/issues/3750

It looks like the issue is due to this command:

node node_modules/.bin/jest

What it does is it tries to run a script but since I’m in Windows, and the target script is a bash script, it doesn’t work. Running the Windows script jest.cmd doesn’t work either since they are involved from node instead of from the command line interpreter.

I just changed the command to invoke the JS script instead.

node node_modules/jest/bin/jest.js

Works like charm!

Full command:

node --expose-gc --inspect-brk -r tsconfig-paths/register
 -r ts-node/register node_modules/jest/bin/jest.js
 --runInBand --logHeapUsage

That’s it!

Posted in NodeJS | Tagged | Leave a comment

The Dreaded node-gyp installation problem on Windows 10

Time and time again, I encounter this dreaded node-gyp installation problem for Windows. I used to get away with in but when the package depends on it, I have no choice but to fix it. I just followed this instructions: … Continue reading

Posted in Uncategorized | Tagged | Leave a comment

Creating Google Storage Buckets with Config Connector

We are trying to build an API to store files for user profile images. To do that in our current infrastructure, we need to use Google Cloud Storage. Since we are already using Kubernetes, we can automate the process by … Continue reading

Posted in jenkis-x, kubernetes | Tagged , | Leave a comment

Kubernetes – Add vault secrets into environment variables

We already have a full kubernetes and Jenkins-X stack for our application’s CI/CD. For a fully setup application, I’m already able to tweak the secrets settings and how the secrets are populated from vault to environment variable. However, for an … Continue reading

Posted in jenkis-x, kubernetes | Tagged , | Leave a comment

React TypeScript – Props not recognized when component is wrapped in some high order components

It is so annoying when you developed your component nicely but when you need to wrap it with some high order components from some cool plugins, props suddenly doesn’t get recognized by the TypeScript compiler. Without knowing the proper way … Continue reading

Posted in React, TypeScript | Tagged | Leave a comment

Viewing Container Logs in Kubernetes

I’m currently working as a developer but also manages the infrastructure of our project which is hosted in Google Cloud Platform. GCP has web console for viewing logs for each of our services and using the web is a bit … Continue reading

Posted in kubernetes | Tagged | Leave a comment

Jenkins-X – Customize release version

We have an existing infrastructure in GCP using Kubernetes and Jenkis-X. When one of the owner decided to leave the business due to personal reasons, we ended up moving all the repositories to the other owner. This caused the releases … Continue reading

Posted in jenkis-x | Leave a comment

Mongo Read hangs up indefinitely when readPreference is secondary

We have a backend API app in Google Cloud using all the Kubernetes goodness. For some reason, we don’t use a Google Cloud backed MongoDB service. Instead, we spin our own MongoDB replicaSet using one of the stable helm charts … Continue reading

Posted in kubernetes, MongoDB | Leave a comment

It’s been a very long time

What’s up? Its been a very long time since I’ve posted something in my blog. I’m been very busy with my current job at a startup and it has gotten a good kick start. I’m also busy with trading equities … Continue reading

Posted in Personal Blog, Trading, Web Development | Leave a comment

Jest tests failing on CircleCI – ENOMEM: not enough memory

Out NestJS tests are intermittently failing with “not enough memory” error being thrown. There is nothing really special about the tests except for the fact that it is growing as the project grows. It turns out a simple CLI parameter … Continue reading

Posted in NodeJS | Tagged | Leave a comment