Skip to content
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

Github actions - tests pass but execution fails on Process completed with exit code 1. #1292

Closed
gnesher opened this issue Feb 25, 2024 · 3 comments

Comments

@gnesher
Copy link

gnesher commented Feb 25, 2024

  • @testing-library/dom version: 7.31.2
  • Testing Framework and version: @testing-library/jest-dom 5.11.4
  • Jest 26.0.15
  • DOM Environment:
    jsdom 27.4.4

Relevant code or config:

N/A

What you did:

Runnig test suit passes fine locally and all tests are reported to have passed successfully on github actions i.e.

Test Suites: 25 passed, 25 total
Tests:       163 passed, 163 total
Snapshots:   85 passed, 85 total
Time:        515.31 s
Ran all test suites matching /^.*\/[C][\w-]*\.test/i.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Process completed with exit code 1.

But tests still fail with exit code 1

Problem description:

Tests pass successfully but the test fails on Github Actions with error code 1 while reporting all tests passed

Suggested solution:

The last time we encountered this issue we solved it by ensuring that waitFor is limited to 1 except (but while this isn't recommended according to https://kentcdodds.com/blog/common-mistakes-with-react-testing-library#having-multiple-assertions-in-a-single-waitfor-callback - it shouldn't cause this

@MatanBobi
Copy link
Member

Hi @gnesher! Thanks for opening this one.
The last version of DTL 7 was released almost 3 years ago, we're not supporting that anymore and a lot has changed since then.
Any chance you can upgrade the libraries you're using to see if it still reproduces?
Thanks.

@MatanBobi
Copy link
Member

I'm closing this as no reproduction was provided.
If anyone is experiencing this and can provide a reproduction, we'll be happy to help :)

@MatanBobi MatanBobi closed this as not planned Won't fix, can't repro, duplicate, stale Jun 7, 2024
@sjpknight
Copy link

sjpknight commented Dec 8, 2024

I'm experiencing this.

2024-12-08T00:03:07.2049575Z PASS Tests\Unit\ExampleTest
2024-12-08T00:03:07.2079489Z ✓ that true is true
2024-12-08T00:03:07.6539289Z
2024-12-08T00:03:07.6539728Z PASS Tests\Feature\EmailTest
2024-12-08T00:03:07.6554146Z ✓ list emails route 0.40s
2024-12-08T00:03:07.6566468Z ✓ create email route 0.04s
2024-12-08T00:03:07.7300975Z
2024-12-08T00:03:07.7301510Z PASS Tests\Feature\WebRoutesTest
2024-12-08T00:03:07.7314238Z ✓ root route 0.03s
2024-12-08T00:03:07.7326491Z ✓ emails route 0.02s
2024-12-08T00:03:07.7338351Z ✓ campaigns route 0.03s
2024-12-08T00:03:07.7340453Z
2024-12-08T00:03:07.7343783Z Tests: 6 passed (12 assertions)
2024-12-08T00:03:07.7344584Z Duration: 0.57s
2024-12-08T00:03:07.7344962Z
2024-12-08T00:03:07.7550815Z ##[error]Process completed with exit code 1.

I've attached the logs. Any input welcomed. It's very frustrating!
GAlogs.txt

[edit for additional info per OP]

Relevant code or config:

PHP, Laravel, PHPUnit

What you did:

Running test suit passes fine locally and all tests are reported to have passed successfully on GitHub Actions:

Run php artisan test

   PASS  Tests\Unit\ExampleTest
  ✓ that true is true

   PASS  Tests\Feature\EmailTest
  ✓ list emails route                                                    0.40s  
  ✓ create email route                                                   0.04s  

   PASS  Tests\Feature\WebRoutesTest
  ✓ root route                                                           0.03s  
  ✓ emails route                                                         0.02s  
  ✓ campaigns route                                                      0.03s  

  Tests:    6 passed (12 assertions)
  Duration: 0.57s

Error: Process completed with exit code 1.

Problem description:
Tests pass successfully but the test fails on Github Actions with error code 1 while reporting all tests passed

Suggested solution:

GitHub CoPilot suggests the following:

Analysis
The logs indicate that the tests in WebRoutesTest passed successfully, but the job still failed with an exit code of 1 due to an issue during the post-job cleanup process. There are no explicit post-job actions defined in the workflow script.

Possible Cause
One potential cause of the failure could be related to the Git commands executed during the post-job cleanup. The log shows several Git commands being executed, which might be causing the job to fail.

Suggested Fixes
Review Git Configuration Steps:
Ensure that the Git configuration steps during the post-job cleanup are correctly configured and not causing the failure.

Debug Post-Job Cleanup:
Add debug statements or additional checks in the workflow script to identify the exact point of failure during the post-job cleanup.

But:

  1. There aren't any post-job cleanup steps.
  2. Same as 1.

I've attached the workflow file also, for context.
tests.yml.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants