nest icon indicating copy to clipboard operation
nest copied to clipboard

fix(core): when debug-repl has duplicated providers

Open micalevisk opened this issue 3 years ago • 1 comments

PR Checklist

Please check if your PR fulfills the following requirements:

  • [x] The commit message follows our guidelines: https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md
  • [x] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • [x] Bugfix
  • [x] 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?

Issue Number: closes #9893 + one minor feature

image

(see the code below)

What is the new behavior?

Now the debug() function will

  • display string tokens with double quotes, so we could easily distinguish between classes references, which also means that $("Foo") and $(Foo) aren't treated alike anymore. So we could have both providers (class Foo {} and { provide: "Foo", ... })
  • display all those providers registered in the module properly
full code + demo

image

I'm not sure if treating string tokens in the same way as class references was intentional but I believe this decreases the flexiblity of the REPL

Does this PR introduce a breaking change?

  • [ ] Yes
  • [x] No(?)

micalevisk avatar Aug 06 '22 14:08 micalevisk

Pull Request Test Coverage Report for Build b8442661-5364-4fae-a4bf-b874ba5f565e

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • 66 unchanged lines in 7 files lost coverage.
  • Overall coverage increased (+0.09%) to 93.911%

Files with Coverage Reduction New Missed Lines %
packages/core/injector/lazy-module-loader.ts 3 76.0%
packages/microservices/server/server-kafka.ts 3 92.39%
packages/common/module-utils/configurable-module.builder.ts 5 91.84%
packages/microservices/server/server-rmq.ts 7 81.58%
packages/core/router/router-explorer.ts 13 79.88%
packages/core/injector/instance-wrapper.ts 17 85.92%
packages/microservices/client/client-rmq.ts 18 81.13%
<!-- Total: 66
Totals Coverage Status
Change from base Build bfe80734-d84f-4a6f-b9b5-a0e280824d1f: 0.09%
Covered Lines: 6030
Relevant Lines: 6421

💛 - Coveralls

coveralls avatar Aug 06 '22 15:08 coveralls

lgtm

kamilmysliwiec avatar Aug 11 '22 13:08 kamilmysliwiec