-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test phase does not report error with exit 1 #2409
Comments
I will add another point here because it's sort of related. If someone gives some sort of feedback on this I can also create a separate ticket for this. The question is: if I have an amplify.yml without test section with connected frontend branches i.e. cloud build associated to git commits, will the amplify build be able to start running tests once I add the test section in the yml? From what I see the answer is no. More in detail, after adding that change: |
Any feedback on this? |
Hi @cfbo , sorry for the late reply. An app for which tests fail shouldn't be deployed, and adding test section to an existing app adds the test step in the workflow. I was unable to reproduce both the scenarios, I am still investigating why this issue happened with you. |
The tests should run on the next deployment. Is this not happening after you've modified the amplify.yml and re-deployed? |
Also can you try installing the |
I also hit this problem (failed tests didn't stop deployment). Using Can you help me understand what Here's what I had that was not working, for a standard create-react-app project that runs tests with jest: version: 1
backend:
phases:
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- npm install
build:
commands:
- npm run build
artifacts:
baseDirectory: build
files:
- '**/*'
cache:
paths:
- node_modules/**/*
test:
phases:
preTest:
commands:
- npm ci
test:
commands:
- CI=true npm test -- --outputFile jestOutput.json --json
artifacts:
baseDirectory: .
configFilePath: 'jestOutput.json'
files:
- '**/__snapshots__/*.snap'
cache:
paths:
- node_modules/**/* Expected resultsFailed tests stop deployment. Actual resultsTests fail, but Amplify doesn't detect it and stop deploying.
Notes:
With
|
|
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Before opening, please confirm:
App Id
d2oeatkcx6u4xt
Region
eu-central-1
Amplify Console feature
Custom builds, E2E tests
Describe the bug
I am reporting the bug as suggested by josef in Discord https://discord.com/channels/705853757799399426/707328986077855836/913090540998909992
The testing phase doesn't pick up an exit 1 code as an error
Expected behavior
exit 1 should make the build fail
Reproduction steps
Use the following
Build Settings
No response
Additional information
To give a bit of context, what I was trying to do is to run jest tests in a lambda as part of the amplify build.
After many attempts I have got the following solution that works when all tests are succeeding, but when there are test failures, jest exits with exit code 1 and that value doesn't make the build fail.
Issues that are partially related:
Please read the discord because there are a lot information and attempts reported around that point: https://discord.com/channels/705853757799399426/707328986077855836/913100295079329904
The text was updated successfully, but these errors were encountered: