-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
31 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,20 +39,22 @@ test('should repsect the NETLIFY_USE_PNPM if no lock file is there', async ({ fs | |
expect(pkgManager?.name).toBe('pnpm') | ||
}) | ||
|
||
test('should favor the NETLIFY_USE_PNPM over a yarn.lock file', async ({ fs }) => { | ||
test('should favor the NETLIFY_USE_PNPM over another lockfile', async ({ fs }) => { | ||
const cwd = mockFileSystem({ | ||
'package.json': '{}', | ||
'yarn.lock': '', | ||
'bun.lockb': '', | ||
}) | ||
const project = new Project(fs, cwd).setEnvironment({ NETLIFY_USE_PNPM: 'true' }) | ||
const pkgManager = await detectPackageManager(project) | ||
expect(pkgManager?.name).toBe('pnpm') | ||
}) | ||
|
||
test('should favor the NETLIFY_USE_YARN over a package-lock.json file', async ({ fs }) => { | ||
test('should favor the NETLIFY_USE_YARN over another lockfile', async ({ fs }) => { | ||
const cwd = mockFileSystem({ | ||
'package.json': '{}', | ||
'package-lock.json': '', | ||
'bun.lockb': '', | ||
}) | ||
const project = new Project(fs, cwd).setEnvironment({ NETLIFY_USE_YARN: 'true' }) | ||
const pkgManager = await detectPackageManager(project) | ||
|
@@ -98,6 +100,16 @@ test('should use pnpm if there is a pnpm-lock.yaml in the root', async ({ fs }) | |
expect(pkgManager?.name).toBe('pnpm') | ||
}) | ||
|
||
test('should use bun if there is a bun.lockb in the root', async ({ fs }) => { | ||
const cwd = mockFileSystem({ | ||
'package.json': '{}', | ||
'bun.lockb': '', | ||
}) | ||
const project = new Project(fs, cwd) | ||
const pkgManager = await detectPackageManager(project) | ||
expect(pkgManager?.name).toBe('bun') | ||
}) | ||
|
||
test('should use the `packageManager` property to detect yarn', async ({ fs }) => { | ||
const cwd = mockFileSystem({ | ||
'package.json': JSON.stringify({ packageManager: '[email protected]' }), | ||
|
@@ -107,6 +119,16 @@ test('should use the `packageManager` property to detect yarn', async ({ fs }) = | |
expect(pkgManager?.name).toBe('yarn') | ||
}) | ||
|
||
test('should use the prefer the `packageManager` property over a lockfile', async ({ fs }) => { | ||
const cwd = mockFileSystem({ | ||
'package.json': JSON.stringify({ packageManager: '[email protected]' }), | ||
'bun.lockb': '', | ||
}) | ||
const project = new Project(fs, cwd) | ||
const pkgManager = await detectPackageManager(project) | ||
expect(pkgManager?.name).toBe('yarn') | ||
}) | ||
|
||
describe('workspaces package manager detection', () => { | ||
test('should use pnpm if there is a pnpm-lock.yaml in the workspace root', async ({ fs }) => { | ||
const cwd = mockFileSystem({ | ||
|
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