Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix merge pnpm workspace config test #1321

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions test/workspaces.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,21 +445,22 @@ describe('stubbed', () => {
})
})

// cnanot be stubbed while npm config printing occurs in viewMany
// TODO: Move npm config reading to init method
// cannot be stubbed while npm config printing occurs in viewMany
describe('not stubbed', () => {
// TODO: Find a less fragile way to test npm config than comparing exact verbose output
it('merge local npm config with pnpm workspace npm config', async () => {
// colors must be stripped on node v18+
const { default: stripAnsi } = await import('strip-ansi')
const tempDir = await setup(['packages/**'], { pnpm: true })
try {
await fs.writeFile(path.join(tempDir, '.npmrc'), 'ncutest=root')
await fs.writeFile(path.join(tempDir, 'packages/a/.npmrc'), 'ncutest=a')
const output = await spawn('node', [bin, '--verbose', '--packageManager', 'pnpm'], {
cwd: path.join(tempDir, 'packages/a'),
})
output.should.include(`npm config (workspace project):
stripAnsi(output).should.include(`npm config (workspace project):
{ ncutest: 'root' }`)
output.should.include(`Using merged npm config:
stripAnsi(output).should.include(`Using merged npm config:
{
ncutest: 'a',`)
} finally {
Expand Down