UNIT TESTS-ENOMEM: not enough memory, read

I am contantly taking this error on build. Does anybody experience the same issue?
● Test suite failed to run
ENOMEM: not enough memory, read
at Object. (node_modules/babel-types/lib/index.js:317:25)

thanks

Hello @chrisgiann44 - Welcome to our CircleCI Community!

You will need to adjust the max memory ceiling in your node builds to avoid this issue. The following support article describes how to accomplish this.

Reference: https://support.circleci.com/hc/en-us/articles/360009208393-How-can-I-increase-the-max-memory-for-Node-

Hi Jonathan,

thanks for ur answer.

image

i did the above. added the NODE_OPTIONS. the first build was successful but i still see this

image

It should not be 8GB Ram?

thanks

Hi Chris,

Currently, you’re still using the medium resource class. You’ll need to configure resource_class: large within that job step. You can either place it underneath <<: *node_defaults or, include it in the node_defaults anchor.

The documentation for resource classes can be found here: https://circleci.com/docs/2.0/configuration-reference/#resource_class

Note: using larger resource classes will increase the amount of credits consumed during your jobs

Hi Jary,

i am trying to establish parallelism so i can make my Cypress tests fisnish much faster.

i set parallelism to 4 but how can i specify which files will be splitted? i can not find on your Doc anything about how to write the command and i dont use CLI of cicrleCi. Can u help me here?

thanks

Just for reference. Memory leaks might happen in Jest. read about it here: https://github.com/facebook/jest/issues/7874. The steps listed optimizes memory usage and I have been able to run tests successfully without running into memory issues. Hope this helps someone. This was executed on the free version of CircleCI with 2CPU/4GB RAM.

steps:
      - checkout
      - run:
          name: Install dependencies
          command: npm ci --no-progress --prefer-offline
      - run:
          name: Run tests
          command: node --expose-gc ./node_modules/.bin/jest --runInBand --logHeapUsage

If you are not on the free version of CircleCI, feel free to add more memory to your tests like this:

      - run:
          name: Run tests
          environment:
            NODE_OPTIONS: --max_old_space_size=8192 

Otherwise you’ll be capped at 4GB.