Publish curated ForgeFlow source from 2ed1787c0b52
This commit is contained in:
commit
f60b269686
254 files changed
+46204
No files matched your search
@@ -0,0 +1,49 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import toolInvocation from '../src/shared/tool-invocation.cjs';
|
||||
import processRunner from '../src/main/process-runner.cjs';
|
||||
|
||||
const { npmProbeCandidates } = toolInvocation;
|
||||
const { run } = processRunner;
|
||||
|
||||
test('uses npm CLI through Node when doctor is launched by npm on Windows', () => {
|
||||
const candidates = npmProbeCandidates({
|
||||
platform: 'win32',
|
||||
execPath: 'C:\\Program Files\\nodejs\\node.exe',
|
||||
env: {
|
||||
npm_execpath: 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
|
||||
npm_node_execpath: 'C:\\Program Files\\nodejs\\node.exe',
|
||||
ComSpec: 'C:\\Windows\\System32\\cmd.exe'
|
||||
}
|
||||
});
|
||||
assert.deepEqual(candidates[0], {
|
||||
file: 'C:\\Program Files\\nodejs\\node.exe',
|
||||
args: ['C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', '--version'],
|
||||
source: 'npm_execpath'
|
||||
});
|
||||
});
|
||||
|
||||
test('falls back to cmd.exe for npm command shims on Windows', () => {
|
||||
const candidates = npmProbeCandidates({
|
||||
platform: 'win32',
|
||||
execPath: 'C:\\Program Files\\nodejs\\node.exe',
|
||||
env: { ComSpec: 'C:\\Windows\\System32\\cmd.exe' }
|
||||
});
|
||||
assert.deepEqual(candidates, [{
|
||||
file: 'C:\\Windows\\System32\\cmd.exe',
|
||||
args: ['/d', '/s', '/c', 'npm --version'],
|
||||
source: 'windows-command-shim'
|
||||
}]);
|
||||
});
|
||||
|
||||
test('uses npm directly on non-Windows systems', () => {
|
||||
assert.deepEqual(npmProbeCandidates({ platform: 'linux', env: {}, execPath: '/usr/bin/node' }), [
|
||||
{ file: 'npm', args: ['--version'], source: 'path' }
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
test('process runner accepts stdin for Git pathspec transport', async () => {
|
||||
const result = await run(process.execPath, ['-e', 'process.stdin.pipe(process.stdout)'], { input: 'a\0b\0' });
|
||||
assert.equal(result.stdout, 'a\0b\0');
|
||||
});
|
||||
Reference in new issue
Block a user