Skip to content

fix(common): resolve file-type path explicitly#16077

Merged
kamilmysliwiec merged 2 commits into
nestjs:masterfrom
shash-hq:fix/file-type-validator-version
Dec 15, 2025
Merged

fix(common): resolve file-type path explicitly#16077
kamilmysliwiec merged 2 commits into
nestjs:masterfrom
shash-hq:fix/file-type-validator-version

Conversation

@shash-hq

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

What is the current behavior?

The FileTypeValidator uses loadEsm('file-type') which can resolve to an incorrect version of file-type in monorepos or when dependencies are hoisted, leading to validation failures with cryptic error messages.

Issue Number: #15270

What is the new behavior?

The validator now explicitly resolves the path to the file-type dependency using require.resolve('file-type') before importing it. This ensures that the version of file-type declared in @nestjs/common is used.

Does this PR introduce a breaking change?

  • Yes
  • No

@coveralls

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 9d9b0d55-7264-4e48-a13d-b705ee67d42a

Details

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.003%) to 89.669%

Totals Coverage Status
Change from base Build eaf9b6b0-1f07-466d-8da5-2f41241edd3c: 0.003%
Covered Lines: 7404
Relevant Lines: 8257

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants