Skip to content

test(core): fix flaky promise assertions in scanner spec#17203

Closed
Se3do wants to merge 1 commit into
nestjs:masterfrom
Se3do:fix/scanner-spec-rejectedwith-await
Closed

test(core): fix flaky promise assertions in scanner spec#17203
Se3do wants to merge 1 commit into
nestjs:masterfrom
Se3do:fix/scanner-spec-rejectedwith-await

Conversation

@Se3do

@Se3do Se3do commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

3 tests in DependenciesScanner.insertModule suite (scanner.spec.ts:409,416,424) are broken chai-as-promised is not loaded so .rejectedWith throws Invalid Chai property. Even if loaded, the promise is not returned to Mocha, so assertions never actually run.

Issue Number: N/A

What is the new behavior?

chai-as-promised is imported and chai.use() called. The 3 assertion promises are returned to Mocha via return. Tests now correctly verify that insertModule rejects @Injectable(), @Controller(), and @Catch() only classes.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 0

Coverage remained the same at 89.912%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 8644
Covered Lines: 7772
Line Coverage: 89.91%
Relevant Branches: 2947
Covered Branches: 2389
Branch Coverage: 81.07%
Branches in Coverage %: No
Coverage Strength: 56.62 hits per line

💛 - Coveralls

@kamilmysliwiec

Copy link
Copy Markdown
Member

i believe this has already been fixed here #16391

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.

3 participants