I have an AWS CodeBuild project for executing automated test cases every night using the Cypress.io framework. Whenever there is at least one failed test case, I get the following error in the build log:
[Container] 2022/03/15 14:18:22 Command did not exit successfully npm run cypress:run exit status 1
[Container] 2022/03/15 14:18:22 Phase complete: BUILD State: FAILED
[Container] 2022/03/15 14:18:22 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: npm run cypress:run. Reason: exit status 1
This is what the custom script looks like:
"cypress:run": "npx cypress run --config-file custom-config.json",
and this is what I have set in the custom-config.json file:
{
"$schema": "https://raw.githubusercontent.com/cypress-io/cypress/develop/cli/schema/cypress.schema.json",
"viewportWidth": 1920,
"viewportHeight": 1080,
"defaultCommandTimeout": 30000,
"requestTimeout": 30000,
"numTestsKeptInMemory": 0,
"trashAssetsBeforeRuns": false,
"video": false,
"env": {
"coverage": false
}
}
Does anyone have any idea what could be causing this?
CodePudding user response:
I think your question already has its answer in it "Whenever there is at least one failed test case, I get the following error in the build log".
In the documentation here , you can find those 2 lines:
"If there are any test failures, then the exit code will match the number of tests that failed."
"If Cypress could not run for some reason (for example if no spec files were found) then the exit code will be 1."