When I try to run my build/test.sh
script file it is unable to find @babel/register
node module.
I have checked that the node_modules folder exists and @babel is contained within the node_modules folder
dockerfile
FROM node:16.16.0-alpine as base
# FROM eu.gcr.io/ccp-management/ce/pdp-spa:3.2.0-base
WORKDIR /usr/src/app
ARG base_image
COPY ./package.json /usr/src/app/package.json
COPY ./yarn.lock /usr/src/app/yarn.lock
COPY ./checkForNodeModules.js /usr/src/app/checkForNodeModules.js
COPY ./pdp-source/dist /usr/src/app/pdp-source/dist
COPY ./test /usr/src/app/test
COPY ./build/test.sh /usr/src/app/build/test.sh
ENV NODE_ENV production
EXPOSE 443
EXPOSE 80
CMD build/test.sh
HEALTHCHECK --interval=5m --timeout=15s \
CMD curl -f http://localhost/health || exit 1
package.json
"scripts": {
"node-modules-check": "node ./checkForNodeModules.js",
"test:e2e": "MOCKED_DATA=true node --require @babel/register \"./test/e2e/testRunner.js\" $SPEC --env $CONFIG",
},
test.sh
yarn install -force || exit
printf '\nEXECUTING npm install DONE.\n'
yarn node-modules-check
NODE_ENV=test CONFIG=desktop SHOP_LANGUAGE=de SHOP_COUNTRY=de yarn test:e2e || exit 1