Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: make cwd required in EngineConfig (#18052)
It was already de facto required for `LibraryEngine` (`BinaryEngine` did handle the missing `cwd`) but it was marked as optional in the `EngineConfig` interface. There were two places which would break if `cwd` wasn't passed to the engine constructor: 1. In `DefaultLibraryLoader` it was assumed that `config.cwd` was non-nullable. TypeScript did not raise an error because another element in the same array was `any`, which caused the whole array to silently be `any[]` and assignable to `string[]`. Fixing that issue immediately uncovered a type error in `this.config.cwd` array item. 2. In `LibraryEngine` `this.config.cwd` was forcibly converted to a non-nullable string with the `!` operator and passed to the query engine constructor. This would trigger an error on the Rust side. Tests in `LibraryEngine.test.ts` didn't have a `cwd` in the engine config, but they still passed because they used a mock engine and library loader which didn't rely on `cwd`. They would fail with real implementations though. A missing `logEmitter` was added along the way in `BinaryEngine.test.ts`. TypeScript did flag that as an error, but we don't type check the old tests. Ref: https://github.com/prisma/client-planning/issues/103
- Loading branch information
Showing
6 changed files
with
10 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters