Skip to content

Commit

Permalink
fix: yarn package manager is missing getPeerDependencies raineorshine…
Browse files Browse the repository at this point in the history
  • Loading branch information
rbnayax committed Jun 2, 2024
1 parent 0f17df2 commit 9050aa9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/package-managers/yarn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,3 +294,5 @@ export const patch = withNpmConfigFromYarn(npm.patch)
export const semver = withNpmConfigFromYarn(npm.semver)

export default spawnYarn

export { getPeerDependencies, packageAuthorChanged } from './npm'
14 changes: 10 additions & 4 deletions test/doctor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const mockNpmVersions = {
'ncu-test-v2': '2.0.0',
}

const [nodeMajorVersion] = process.versions.node.split('.').map(Number)

/** Run the ncu CLI. */
const ncu = async (
args: string[],
Expand Down Expand Up @@ -109,8 +111,10 @@ describe('doctor', function () {
await fs.rm(lockfilePath, { recursive: true, force: true })
await fs.rm(nodeModulesPath, { recursive: true, force: true })

// stderr should be empty
stderr.should.equal('')
if (nodeMajorVersion !== 18) {
// stderr should be empty
stderr.should.equal('')
}

// stdout should include normal output
stripAnsi(stdout).should.containIgnoreCase('Tests pass')
Expand Down Expand Up @@ -154,8 +158,10 @@ describe('doctor', function () {
await fs.rm(lockfilePath, { recursive: true, force: true })
await fs.rm(nodeModulesPath, { recursive: true, force: true })

// stderr should be empty
stderr.should.equal('')
if (nodeMajorVersion !== 18) {
// stderr should be empty
stderr.should.equal('')
}

// stdout should include normal output
stripAnsi(stdout).should.containIgnoreCase('Tests pass')
Expand Down
13 changes: 13 additions & 0 deletions test/helpers/doctorHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,22 @@ export const testPass = ({ packageManager }: { packageManager: PackageManagerNam
await fs.rm(path.join(cwd, '.pnp.js'), { recursive: true, force: true })
}

const [nodeMajorVersion] = process.versions.node.split('.').map(Number)
// bun prints the run header to stderr instead of stdout
if (packageManager === 'bun') {
stripAnsi(stderr).should.equal('$ echo Success\n\n$ echo Success\n\n')
} else if (packageManager === 'npm' && nodeMajorVersion === 18) {
stripAnsi(stderr).should.equal(`
> test
> echo Success
> test
> echo Success
`)
} else {
stderr.should.equal('')
}
Expand Down

0 comments on commit 9050aa9

Please sign in to comment.