-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(use): create
package.json
when calling corepack use
on empty dir
- Loading branch information
Showing
4 changed files
with
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ describe(`UseCommand`, () => { | |
it(`should set the package manager in the current project`, async () => { | ||
await xfs.mktempPromise(async cwd => { | ||
await xfs.writeJsonPromise(ppath.join(cwd, `package.json`), { | ||
packageManager: `[email protected]`, | ||
}); | ||
|
||
await expect(runCli(cwd, [`use`, `[email protected]`])).resolves.toMatchObject({ | ||
|
@@ -29,4 +30,21 @@ describe(`UseCommand`, () => { | |
}); | ||
}); | ||
}); | ||
|
||
it(`should create a package.json if absent`, async () => { | ||
await xfs.mktempPromise(async cwd => { | ||
await expect(runCli(cwd, [`use`, `[email protected]`])).resolves.toMatchObject({ | ||
exitCode: 0, | ||
}); | ||
|
||
await expect(xfs.readJsonPromise(ppath.join(cwd, `package.json`))).resolves.toMatchObject({ | ||
packageManager: `[email protected]+sha256.bc5316aa110b2f564a71a3d6e235be55b98714660870c5b6b2d2d3f12587fb58`, | ||
}); | ||
|
||
await expect(runCli(cwd, [`yarn`, `--version`])).resolves.toMatchObject({ | ||
exitCode: 0, | ||
stdout: `1.22.4\n`, | ||
}); | ||
}); | ||
}); | ||
}); |