Skip to content

test(core,common): register chai-as-promised in async-rejection specs#16973

Closed
HarrierOnChain wants to merge 1 commit into
nestjs:masterfrom
HarrierOnChain:test/register-chai-as-promised-in-async-rejection-specs
Closed

test(core,common): register chai-as-promised in async-rejection specs#16973
HarrierOnChain wants to merge 1 commit into
nestjs:masterfrom
HarrierOnChain:test/register-chai-as-promised-in-async-rejection-specs

Conversation

@HarrierOnChain
Copy link
Copy Markdown
Contributor

Several spec files use chai-as-promised idioms (.rejectedWith, .fulfilled, .eventually) without calling chai.use(chaiAsPromised) in the file. Today these tests still pass in npm run test because some other spec alphabetically earlier in the glob registers the plugin, and the registration leaks into the shared chai instance for subsequent files.

Running any of these specs in isolation (e.g. mocha packages/core/test/scanner.spec.ts) fails with Invalid Chai property: rejectedWith. The assertion silently returns undefined, so the tests pass without actually asserting anything.

This PR follows the existing convention used by injector.spec.ts, middleware-module.spec.ts, and others: each affected spec now imports and registers chai-as-promised itself. 13 previously inert assertions across 8 files now actually run.

@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 0

Coverage remained the same at 89.908%

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: 8571
Covered Lines: 7706
Line Coverage: 89.91%
Relevant Branches: 2924
Covered Branches: 2371
Branch Coverage: 81.09%
Branches in Coverage %: No
Coverage Strength: 56.48 hits per line

💛 - Coveralls

@kamilmysliwiec
Copy link
Copy Markdown
Member

#16391

@HarrierOnChain
Copy link
Copy Markdown
Contributor Author

Could you tell me what the problem is?
I have already checked PR #16391.

@kamilmysliwiec
Copy link
Copy Markdown
Member

we are removing chai in the next release (altogether), the PR i shared will be merged soon

@HarrierOnChain
Copy link
Copy Markdown
Contributor Author

oh, great choice

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