* Test setting defaultShell to cmd (Windows Command Prompt)
()
| 218 | * Test setting defaultShell to cmd (Windows Command Prompt) |
| 219 | */ |
| 220 | async 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) |
no test coverage detected