Problem to run tests with command 'npm run test' before code deployments

Hi everyone
Have a problem with test command
Configuration

version: 2.1
orbs:
  node: circleci/node@4.1.0
...
jobs:
  initial-check:
    docker:
    - image: cimg/base:stable
    steps:
    - checkout
    - node/install
    - node/install-packages:
        cache-path: ~/project/node_modules
        override-ci-command: npm install
    - run: npm run test

The code “- run: npm run test” fires error

Test duration: 174 ms
Assertions count: 37 (verbosity: 2.85)
The following leaks were detected:DOMException, structuredClone
Lint: No issues

All tests successful on local machine

Hi @plcgi1 – welcome to Discuss!

My guess as to why you aren’t seeing this locally is you are on a different version of Node locally. When you run the node/install command it’s going to install I think the latest version, when I tested it installed v17.1.0. I found the following:

Screen Shot 2021-11-30 at 8.59.19 AM

This seems to indicate that on Node 17 you’ll get that DOMException error you are seeing, it could also be why you are seeing the other leak as well.

Can you try installing the same version you have locally via the install command:

https://circleci.com/developer/orbs/orb/circleci/node?version=4.1.0#commands-install

And see if that helps with your CI build?

Thanks!
-Nick

1 Like

Thanks for your answer! I’ve got the same problem and after updating Node version on my local machine, Ive found out that the issue was with hapi js version :slightly_smiling_face: