Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: path the project directory to the readPackage hook (#5475)
close #5443
- Loading branch information
Showing
4 changed files
with
27 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@pnpm/hooks.read-package-hook": patch | ||
--- | ||
|
||
The readPackageHooks should always get the project directory as the second argument. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"pnpm": patch | ||
--- | ||
|
||
It should be possible to override dependencies with local packages using overrides [#5443](https://github.com/pnpm/pnpm/issues/5443). |
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
16 changes: 16 additions & 0 deletions
16
packages/hooks.read-package-hook/test/createReadPackageHook.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { createReadPackageHook } from '../lib/createReadPackageHook' | ||
|
||
test('createReadPackageHook() is passing directory to all hooks', async () => { | ||
const hook1 = jest.fn((manifest) => manifest) | ||
const hook2 = jest.fn((manifest) => manifest) | ||
const readPackageHook = createReadPackageHook({ | ||
ignoreCompatibilityDb: true, | ||
lockfileDir: '/foo', | ||
readPackageHook: [hook1, hook2], | ||
}) | ||
const manifest = {} | ||
const dir = '/bar' | ||
await readPackageHook!(manifest, dir) | ||
expect(hook1).toBeCalledWith(manifest, dir) | ||
expect(hook2).toBeCalledWith(manifest, dir) | ||
}) |