Skip to content

Commit e4f4d02

Browse files
authored
Merge pull request #380 from salesforcecli/mdonnalley/update-npm-install-test
fix: remove expectation that sf will exist alongside sfdx npm installs
2 parents a960cc7 + 2a64078 commit e4f4d02

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

src/commands/cli/install/test.ts

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { flags, FlagsConfig, SfdxCommand, UX } from '@salesforce/command';
1111
import { fs, Messages } from '@salesforce/core';
1212
import { ensure, Nullable } from '@salesforce/ts-types';
1313
import got from 'got';
14-
import { exec, which } from 'shelljs';
14+
import { exec } from 'shelljs';
1515
import * as chalk from 'chalk';
1616
import stripAnsi = require('strip-ansi');
1717
import { Channel, CLI, ServiceAvailability } from '../../../types';
@@ -269,20 +269,15 @@ class Npm extends Method.Base {
269269

270270
private test(): Record<CLI, boolean> {
271271
const results = {} as Record<CLI, boolean>;
272-
for (const cli of this.getTargets()) {
273-
const executable =
274-
this.options.cli === CLI.SFDX && cli === CLI.SF
275-
? which(CLI.SF).stdout
276-
: path.join(this.options.directory, 'node_modules', '.bin', cli);
277-
this.logger.log(`Testing ${chalk.cyan(executable)}`);
272+
const executable = path.join(this.options.directory, 'node_modules', '.bin', this.options.cli);
273+
this.logger.log(`Testing ${chalk.cyan(executable)}`);
278274

279-
const result =
280-
process.platform === 'win32'
281-
? exec(`& "${executable}" --version`, { silent: true, shell: 'powershell.exe' })
282-
: exec(`${executable} --version`, { silent: true });
283-
this.logger.log(chalk.dim((result.stdout ?? result.stderr).replace(/\n*$/, '')));
284-
results[cli] = result.code === 0;
285-
}
275+
const result =
276+
process.platform === 'win32'
277+
? exec(`& "${executable}" --version`, { silent: true, shell: 'powershell.exe' })
278+
: exec(`${executable} --version`, { silent: true });
279+
this.logger.log(chalk.dim((result.stdout ?? result.stderr).replace(/\n*$/, '')));
280+
results[this.options.cli] = result.code === 0;
286281
return results;
287282
}
288283
}

0 commit comments

Comments
 (0)