docker-node icon indicating copy to clipboard operation
docker-node copied to clipboard

`npm test` not working within the most recent node:16 docker image

Open mb0p opened this issue 4 years ago • 2 comments

Environment

docker --version: Docker version 20.10.6, build 370c289

Expected Behavior

npm test should run properly

Current Behavior

npm test segfaults:

# npm test

> [email protected] test
> jest --detectOpenHandles

 PASS  ./test.ts
  Test
    ✓ should pass (11 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        2.172 s
Ran all test suites.
Segmentation fault

Steps to Reproduce

create a directory and within that directory add two files: package.json:

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "jest --detectOpenHandles"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "jest": "^27.0.5"
  }
}

and test.ts

describe('Test', () => {
    it('should pass', () => {
        expect(1).toEqual(1);
    });
});

then run this within the docker image: docker run -it --entrypoint /bin/sh -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd):$(pwd) -w $(pwd) node:16 once inside, simply run npm test

mb0p avatar Jun 25 '21 04:06 mb0p

Is this a side affect of running with https://jestjs.io/docs/cli#--detectopenhandles or does it happen without the flag

nschonni avatar Jun 25 '21 04:06 nschonni

@nschonni seems like it is indeed a side effect of running with the --detectOpenHandles flag

mb0p avatar Jun 25 '21 04:06 mb0p