* Test setting defaultShell to bash
()
| 186 | * Test setting defaultShell to bash |
| 187 | */ |
| 188 | async 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) |
no test coverage detected