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

Function testDefaultShellBash

test/test-default-shell.js:188–215  ·  view source on GitHub ↗

* Test setting defaultShell to bash

()

Source from the content-addressed store, hash-verified

186 * Test setting defaultShell to bash
187 */
188async function testDefaultShellBash() {
189 console.log('\nTest 2: Setting defaultShell to /bin/bash');
190
191 // Check if /bin/bash is available
192 const isAvailable = await isShellAvailable('/bin/bash');
193 if (!isAvailable) {
194 console.log('⚠️ Skipping /bin/bash test: shell not available on this system');
195 return;
196 }
197
198 // Set defaultShell to /bin/bash (use full path)
199 await configManager.setValue('defaultShell', '/bin/bash');
200
201 // Verify config was set correctly
202 const config = await configManager.getConfig();
203 assert.strictEqual(config.defaultShell, '/bin/bash', 'defaultShell should be set to /bin/bash');
204 console.log(`✓ Configuration updated: defaultShell = ${config.defaultShell}`);
205
206 // Execute echo $0 to check the shell
207 const shellOutput = await getShellFromCommand(config.defaultShell);
208 console.log(`✓ Command output: ${shellOutput}`);
209
210 // Verify the shell is /bin/bash (note: bash may show as just "bash" or full path)
211 const expectedOutputs = getExpectedShellOutput('/bin/bash');
212 const isValidOutput = expectedOutputs.includes(shellOutput);
213 assert(isValidOutput, `Shell should be one of ${expectedOutputs.join(', ')}, got: ${shellOutput}`);
214 console.log('✓ Test 2 passed: /bin/bash is correctly set as default shell');
215}
216
217/**
218 * Test setting defaultShell to cmd (Windows Command Prompt)

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