diff --git a/packages/pnpm/src/main.ts b/packages/pnpm/src/main.ts index c8947f92af..1df9124875 100644 --- a/packages/pnpm/src/main.ts +++ b/packages/pnpm/src/main.ts @@ -144,6 +144,7 @@ export default async function run (inputArgv: string[]) { } // tslint:enable const { argv, ...cliConf } = nopt(types, shortHands, inputArgv, 0) + process.env['npm_config_argv'] = JSON.stringify(argv) let cmd = getCommandFullName(argv.remain[0]) as CANONICAL_COMMAND_NAMES || 'help' diff --git a/packages/pnpm/test/recursive/list.ts b/packages/pnpm/test/recursive/list.ts index a63daf1014..0bbf345664 100644 --- a/packages/pnpm/test/recursive/list.ts +++ b/packages/pnpm/test/recursive/list.ts @@ -91,7 +91,7 @@ test('recursive list with shared-workspace-lockfile', async (t: tape.Test) => { await execPnpm('recursive', 'install', '--store', 'store') - const result = execPnpmSync('recursive', 'list') + const result = execPnpmSync('recursive', 'list', '--depth', '2') t.equal(result.status, 0) diff --git a/packages/pnpm/test/utils/execPnpm.ts b/packages/pnpm/test/utils/execPnpm.ts index 899024fde5..5fbc2dd936 100644 --- a/packages/pnpm/test/utils/execPnpm.ts +++ b/packages/pnpm/test/utils/execPnpm.ts @@ -65,8 +65,7 @@ export function execPnpxSync (...args: string[]): ChildProcess { } function createEnv (opts?: {storeDir?: string}) { - const _ = { - ...process.env, + const env = { npm_config_fetch_retries: 4, npm_config_hoist: true, npm_config_independent_leaves: false, @@ -76,11 +75,11 @@ function createEnv (opts?: {storeDir?: string}) { // Although this is the default value of verify-store-integrity (as of pnpm 1.38.0) // on CI servers we set it to `false`. That is why we set it back to true for the tests npm_config_verify_store_integrity: 'true', - } as any // tslint:disable-line:no-any - delete _.npm_config_link_workspace_packages - delete _.npm_config_save_exact - delete _.npm_config_shared_workspace_lockfile - delete _.npm_config_workspace_concurrency - delete _.npm_config_use_beta_cli - return _ + } + for (let [key, value] of Object.entries(process.env)) { + if (!key.startsWith('npm_config_')) { + env[key] = value + } + } + return env }