nest icon indicating copy to clipboard operation
nest copied to clipboard

fix(core): auto flush logs on synchronous internal errors

Open micalevisk opened this issue 1 year ago • 1 comments
trafficstars

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
  • [ ] 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 #13400

What is the new behavior?

For the following code

import { NestFactory } from '@nestjs/core'
import { AppModule } from './app.module' // no-op module

async function bootstrap() {
  const app = await NestFactory.create(AppModule, {
    bufferLogs: true,
    autoFlushLogs: true,
  });
  app.get('foo')
  await app.listen(3000);
}

bootstrap();

we'll see the following error:

image

Do note that if autoFlushLogs is false, no logs will be shown for the above code.

Does this PR introduce a breaking change?

  • [ ] Yes
  • [x] No

micalevisk avatar Apr 07 '24 16:04 micalevisk

Pull Request Test Coverage Report for Build 7aab33f9-738b-4c84-a4cb-bbe8a92bad8a

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 92.123%

Totals Coverage Status
Change from base Build eacd3e56-4bed-4f5e-9bab-412a10335aab: 0.0%
Covered Lines: 6736
Relevant Lines: 7312

💛 - Coveralls

coveralls avatar Apr 07 '24 17:04 coveralls