I have a React app that I generated using Create React App. I'd like to make sure the tests pass before the build starts in AWS CodePipeline. Here is my buildspec.yml
file which works just fine without the npm test
command. Once I add the test command, it runs the tests, which I have setup to fail, and then the build just hangs.
version: 0.2
phases:
install:
commands:
- cd react/menu && npm install
build:
commands:
- npm test
- npm run-script build
artifacts:
files: "**/*"
base-directory: "react/menu/build"
I was able to get it to work by turning off watch mode as @haseeb-anwar suggested.
version: 0.2
phases:
install:
commands:
- cd react/menu && npm install
build:
commands:
- npm test -- --watchAll=false
- npm run-script build
artifacts:
files: "**/*"
base-directory: "react/menu/build"