Skip to content

SONARAZDO-589 Fix test using promise-returning assertion without awaiting - #585

Merged
antoine-vinot-sonarsource merged 1 commit into
masterfrom
avi/fix-QP-issues
Jun 18, 2026
Merged

SONARAZDO-589 Fix test using promise-returning assertion without awaiting#585
antoine-vinot-sonarsource merged 1 commit into
masterfrom
avi/fix-QP-issues

Conversation

@antoine-vinot-sonarsource

@antoine-vinot-sonarsource antoine-vinot-sonarsource commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Fixes issues appearing after new rules were added to the Typescript QP.


Summary by Gitar

  • Test fixes:
    • Added async/await to tests in api-test.ts to properly handle promise-returning assertions
    • Corrected expect(...).rejects.toThrow() calls that were previously missing the required await

This will update automatically on new commits.

@antoine-vinot-sonarsource
antoine-vinot-sonarsource requested a review from a team as a code owner June 18, 2026 12:00
@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod Bot changed the title Fix test using promise-returning assertion without awaiting SONARAZDO-589 Fix test using promise-returning assertion without awaiting Jun 18, 2026
@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Jun 18, 2026

Copy link
Copy Markdown

SONARAZDO-589

@gitar-bot

gitar-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Added missing await statements to promise-returning assertions in api-test.ts, ensuring proper test execution and validation. No issues found.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqube-next

Copy link
Copy Markdown

Quality Gate passed Quality Gate passed for 'Azure DevOps extension for SonarQube Server'

Issues
0 New issues
5 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
0 Dependency risks
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube

@sonarqube-next

Copy link
Copy Markdown

Quality Gate passed Quality Gate passed for 'Azure DevOps extension for SonarQube Cloud'

Issues
0 New issues
5 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
0 Dependency risks
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube

@zglicz zglicz left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change makes sense: for Jest .rejects, the assertion promise should be awaited, while the promise under test should be passed directly to expect(...).

One follow-up worth considering: the same unawaited .rejects pattern is still present in the sibling common variants:

  • src/common/sonarqube-v7/helpers/__tests__/api-test.ts:125, :133, :185, :198, :205
  • src/common/sonarcloud-v3/helpers/__tests__/api-test.ts:125, :133, :185, :198, :205

Those look like active test packages under the root npm test wiring, so it would be good to apply the same cleanup there too, either in this PR or a follow-up.

@antoine-vinot-sonarsource

Copy link
Copy Markdown
Contributor Author

The change makes sense: for Jest .rejects, the assertion promise should be awaited, while the promise under test should be passed directly to expect(...).

One follow-up worth considering: the same unawaited .rejects pattern is still present in the sibling common variants:

  • src/common/sonarqube-v7/helpers/__tests__/api-test.ts:125, :133, :185, :198, :205
  • src/common/sonarcloud-v3/helpers/__tests__/api-test.ts:125, :133, :185, :198, :205

Those look like active test packages under the root npm test wiring, so it would be good to apply the same cleanup there too, either in this PR or a follow-up.

@zglicz Thank you for the review!
v7 and v3 are deprecated versions of our tasks. I made a deliberate choice to not touch them and accepted the related issues.

@antoine-vinot-sonarsource
antoine-vinot-sonarsource merged commit 50e1c57 into master Jun 18, 2026
39 checks passed
@antoine-vinot-sonarsource
antoine-vinot-sonarsource deleted the avi/fix-QP-issues branch June 18, 2026 12:39
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

Successfully merging this pull request may close these issues.

2 participants