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

Function testDefaultShellSh

test/test-default-shell.js:156–183  ·  view source on GitHub ↗

* Test setting defaultShell to /bin/sh

()

Source from the content-addressed store, hash-verified

154 * Test setting defaultShell to /bin/sh
155 */
156async function testDefaultShellSh() {
157 console.log('\nTest 1: Setting defaultShell to /bin/sh');
158
159 // Check if /bin/sh is available
160 const isAvailable = await isShellAvailable('/bin/sh');
161 if (!isAvailable) {
162 console.log('⚠️ Skipping /bin/sh test: shell not available on this system');
163 return;
164 }
165
166 // Set defaultShell to /bin/sh
167 await configManager.setValue('defaultShell', '/bin/sh');
168
169 // Verify config was set correctly
170 const config = await configManager.getConfig();
171 assert.strictEqual(config.defaultShell, '/bin/sh', 'defaultShell should be set to /bin/sh');
172 console.log(`✓ Configuration updated: defaultShell = ${config.defaultShell}`);
173
174 // Execute echo $0 to check the shell
175 const shellOutput = await getShellFromCommand(config.defaultShell);
176 console.log(`✓ Command output: ${shellOutput}`);
177
178 // Verify the shell is /bin/sh
179 const expectedOutputs = getExpectedShellOutput('/bin/sh');
180 const isValidOutput = expectedOutputs.includes(shellOutput);
181 assert(isValidOutput, `Shell should be one of ${expectedOutputs.join(', ')}, got: ${shellOutput}`);
182 console.log('✓ Test 1 passed: /bin/sh is correctly set as default shell');
183}
184
185/**
186 * Test setting defaultShell to bash

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