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

sf force lightning lwc test run returns exit code 0 when tests fail #2991

Open
jamessimone opened this issue Aug 22, 2024 · 7 comments
Open
Labels
more information required Issue requires more information or a response from the customer

Comments

@jamessimone
Copy link

jamessimone commented Aug 22, 2024

Summary

Using latest CLI version (@salesforce/cli/2.55.6 win32-x64 node-v20.16.0), these two commands differ when encountering failing LWC jest tests:

  • npx sfdx-lwc-jest --skipApiVersionCheck - returns exit code 1
  • sf force lightning lwc test run - returns exit code 0

This improperly suppresses failures when relying on exit codes (such as in pipeline runs)

Steps To Reproduce

describe('sample failure', () => {
  it('fails', () => {
    expect(1).toBe(2);
  })
})

Expected result

CLI should return exit code 1 when using sf force lightning lwc test run with any test failure

Actual result

CLI returns exit code 0

@jamessimone jamessimone added the investigating We're actively investigating this issue label Aug 22, 2024
Copy link

Hello @jamessimone 👋 It looks like you didn't include the full Salesforce CLI version information in your issue.
Please provide the output of version --verbose --json for the CLI you're using (sf or sfdx).

A few more things to check:

  • Make sure you've provided detailed steps to reproduce your issue.
    • A repository that clearly demonstrates the bug is ideal.
  • Make sure you've installed the latest version of Salesforce CLI. (docs)
    • Better yet, try the rc or nightly versions. (docs)
  • Try running the doctor command to diagnose common issues.
  • Search GitHub for existing related issues.

Thank you!

@github-actions github-actions bot added more information required Issue requires more information or a response from the customer and removed investigating We're actively investigating this issue labels Aug 22, 2024
Copy link

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

Copy link

This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted.

@jamessimone
Copy link
Author

This issue should not be closed

@cristiand391
Copy link
Member

hey, sorry for the late reply.

the command should return the same exit code that sfdx-lwc-test does:
https://github.com/salesforcecli/plugin-lwc-test/blob/024530c2ac27f3097f4edb075ccb1cc3b14cabf4/src/commands/force/lightning/lwc/test/run.ts#L60

but looking at the e2e test it seems that hasn't been the case:
https://github.com/salesforcecli/plugin-lwc-test/blob/024530c2ac27f3097f4edb075ccb1cc3b14cabf4/test/commands/lwc/test/run.nut.ts#L84

we'll discuss with the owners of sfdx-lwc-test about the current state of the lwc commands and get back.

Copy link

This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted.

@github-actions github-actions bot added the stale label Sep 12, 2024
@jamessimone
Copy link
Author

Bump

@github-actions github-actions bot removed the stale label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more information required Issue requires more information or a response from the customer
Projects
None yet
Development

No branches or pull requests

2 participants