MCPcopy Create free account
hub / github.com/wonderwhy-er/DesktopCommanderMCP / testDefaultShellCmd

Function testDefaultShellCmd

test/test-default-shell.js:220–247  ·  view source on GitHub ↗

* Test setting defaultShell to cmd (Windows Command Prompt)

()

Source from the content-addressed store, hash-verified

218 * Test setting defaultShell to cmd (Windows Command Prompt)
219 */
220async function testDefaultShellCmd() {
221 console.log('\nTest 3: Setting defaultShell to cmd');
222
223 // Check if cmd is available (Windows only)
224 const isAvailable = await isShellAvailable('cmd');
225 if (!isAvailable) {
226 console.log('⚠️ Skipping cmd test: shell not available on this system (likely not Windows)');
227 return;
228 }
229
230 // Set defaultShell to cmd
231 await configManager.setValue('defaultShell', 'cmd');
232
233 // Verify config was set correctly
234 const config = await configManager.getConfig();
235 assert.strictEqual(config.defaultShell, 'cmd', 'defaultShell should be set to cmd');
236 console.log(`✓ Configuration updated: defaultShell = ${config.defaultShell}`);
237
238 // Execute echo %0 to check the shell (Windows command)
239 const shellOutput = await getShellFromCommand('cmd');
240 console.log(`✓ Command output: ${shellOutput}`);
241
242 // Verify the shell is cmd
243 const expectedOutputs = getExpectedShellOutput('cmd');
244 const isValidOutput = expectedOutputs.includes(shellOutput);
245 assert(isValidOutput, `Shell should be one of ${expectedOutputs.join(', ')}, got: ${shellOutput}`);
246 console.log('✓ Test 3 passed: cmd is correctly set as default shell');
247}
248
249/**
250 * Test setting defaultShell to pwsh (PowerShell Core)

Callers 1

runDefaultShellTestsFunction · 0.85

Calls 7

isShellAvailableFunction · 0.85
getShellFromCommandFunction · 0.85
getExpectedShellOutputFunction · 0.85
logMethod · 0.80
setValueMethod · 0.80
getConfigMethod · 0.80
assertFunction · 0.70

Tested by

no test coverage detected