-1

I have built docker test image using multistage and in the final image not recommended to install npm. But using the final image i have to trigger jest testcases. Is there any way to trigger jest testcases without using npm/node commands?

  1. Not recommended to install npm at final image.
  2. Using final image, i need to trigger jest testcases.

How do i run jest testcases without using npm command?

I have built multistage docker image, in stage #1 i have installed npm and in stage#2 i have copied node_modules folder and while running final image, through shell script file i gave npm start command to trigger jest testcase but npm command is not found at final image.

./start.sh: line 6: npm: command not found

How do i run jest testcases without using npm command?

  • Who says it's not recommended to install npm? If this container is _for running tests_ then it seems perfectly reasonable to install the tool you use to do that. – jonrsharpe Mar 09 '23 at 10:03

1 Answers1

0

you can also install Jest globally in your Docker image by adding a command like this to your Dockerfile: RUN npm install -g jest Then you can modify your start.sh file to use the globally installed jest command:

#!/bin/sh

jest