chore: fix CI

This commit is contained in:
Ralph Khreish
2025-07-18 00:59:00 +03:00
parent da3cf08d6e
commit 4a24b997c3
4 changed files with 30 additions and 10 deletions

View File

@@ -55,11 +55,12 @@ describe('Kiro Integration', () => {
// Simulate directory creation calls - these will call the mocked mkdirSync // Simulate directory creation calls - these will call the mocked mkdirSync
fs.mkdirSync(path.join(tempDir, '.kiro'), { recursive: true }); fs.mkdirSync(path.join(tempDir, '.kiro'), { recursive: true });
fs.mkdirSync(path.join(tempDir, '.kiro', 'steering'), { recursive: true }); fs.mkdirSync(path.join(tempDir, '.kiro', 'steering'), { recursive: true });
fs.mkdirSync(path.join(tempDir, '.kiro', 'settings'), { recursive: true });
// Create MCP config file at .kiro/mcp.json (not in settings subdirectory) // Create MCP config file at .kiro/settings/mcp.json
// This will call the mocked writeFileSync // This will call the mocked writeFileSync
fs.writeFileSync( fs.writeFileSync(
path.join(tempDir, '.kiro', 'mcp.json'), path.join(tempDir, '.kiro', 'settings', 'mcp.json'),
JSON.stringify({ mcpServers: {} }, null, 2) JSON.stringify({ mcpServers: {} }, null, 2)
); );
@@ -97,6 +98,12 @@ describe('Kiro Integration', () => {
recursive: true recursive: true
} }
); );
expect(fs.mkdirSync).toHaveBeenCalledWith(
path.join(tempDir, '.kiro', 'settings'),
{
recursive: true
}
);
}); });
test('creates Kiro mcp.json with mcpServers format', () => { test('creates Kiro mcp.json with mcpServers format', () => {
@@ -105,7 +112,7 @@ describe('Kiro Integration', () => {
// Assert // Assert
expect(fs.writeFileSync).toHaveBeenCalledWith( expect(fs.writeFileSync).toHaveBeenCalledWith(
path.join(tempDir, '.kiro', 'mcp.json'), path.join(tempDir, '.kiro', 'settings', 'mcp.json'),
JSON.stringify({ mcpServers: {} }, null, 2) JSON.stringify({ mcpServers: {} }, null, 2)
); );
}); });

View File

@@ -44,8 +44,8 @@ describe('MCP Configuration Validation', () => {
kiro: { kiro: {
shouldHaveMcp: true, shouldHaveMcp: true,
expectedDir: '.kiro', expectedDir: '.kiro',
expectedConfigName: 'mcp.json', expectedConfigName: 'settings/mcp.json',
expectedPath: '.kiro/mcp.json' expectedPath: '.kiro/settings/mcp.json'
}, },
opencode: { opencode: {
shouldHaveMcp: true, shouldHaveMcp: true,
@@ -134,6 +134,7 @@ describe('MCP Configuration Validation', () => {
test('should ensure all MCP-enabled profiles use proper directory structure', () => { test('should ensure all MCP-enabled profiles use proper directory structure', () => {
const rootProfiles = ['opencode', 'claude', 'codex']; // Profiles that use root directory for config const rootProfiles = ['opencode', 'claude', 'codex']; // Profiles that use root directory for config
const nestedConfigProfiles = ['kiro']; // Profiles that use nested directories for config
RULE_PROFILES.forEach((profileName) => { RULE_PROFILES.forEach((profileName) => {
const profile = getRulesProfile(profileName); const profile = getRulesProfile(profileName);
@@ -146,6 +147,11 @@ describe('MCP Configuration Validation', () => {
// Other root profiles normalize to just the filename (no ./ prefix) // Other root profiles normalize to just the filename (no ./ prefix)
expect(profile.mcpConfigPath).toMatch(/^[\w_.]+$/); expect(profile.mcpConfigPath).toMatch(/^[\w_.]+$/);
} }
} else if (nestedConfigProfiles.includes(profileName)) {
// Profiles with nested config directories
expect(profile.mcpConfigPath).toMatch(
/^\.[\w-]+\/[\w-]+\/[\w_.]+$/
);
} else { } else {
// Other profiles should have config files in their specific directories // Other profiles should have config files in their specific directories
expect(profile.mcpConfigPath).toMatch(/^\.[\w-]+\/[\w_.]+$/); expect(profile.mcpConfigPath).toMatch(/^\.[\w-]+\/[\w_.]+$/);
@@ -353,6 +359,13 @@ describe('MCP Configuration Validation', () => {
// Other root profiles normalize to just the filename // Other root profiles normalize to just the filename
expect(profile.mcpConfigPath).toBe(profile.mcpConfigName); expect(profile.mcpConfigPath).toBe(profile.mcpConfigName);
} }
} else if (profileName === 'kiro') {
// Kiro has a nested config structure
const parts = profile.mcpConfigPath.split('/');
expect(parts).toHaveLength(3); // Should be profileDir/settings/mcp.json
expect(parts[0]).toBe(profile.profileDir);
expect(parts[1]).toBe('settings');
expect(parts[2]).toBe('mcp.json');
} else { } else {
// Non-root profiles should have profileDir/configName structure // Non-root profiles should have profileDir/configName structure
const parts = profile.mcpConfigPath.split('/'); const parts = profile.mcpConfigPath.split('/');

View File

@@ -202,8 +202,8 @@ Use the .mdc extension for all rule files.`;
expect(kiroProfile.displayName).toBe('Kiro'); expect(kiroProfile.displayName).toBe('Kiro');
expect(kiroProfile.profileDir).toBe('.kiro'); expect(kiroProfile.profileDir).toBe('.kiro');
expect(kiroProfile.mcpConfig).toBe(true); expect(kiroProfile.mcpConfig).toBe(true);
expect(kiroProfile.mcpConfigName).toBe('mcp.json'); expect(kiroProfile.mcpConfigName).toBe('settings/mcp.json');
expect(kiroProfile.mcpConfigPath).toBe('.kiro/mcp.json'); expect(kiroProfile.mcpConfigPath).toBe('.kiro/settings/mcp.json');
expect(kiroProfile.includeDefaultRules).toBe(true); expect(kiroProfile.includeDefaultRules).toBe(true);
expect(kiroProfile.fileMap).toEqual({ expect(kiroProfile.fileMap).toEqual({
'rules/cursor_rules.mdc': 'kiro_rules.md', 'rules/cursor_rules.mdc': 'kiro_rules.md',

View File

@@ -215,8 +215,8 @@ describe('Rule Transformer - General', () => {
}, },
kiro: { kiro: {
mcpConfig: true, mcpConfig: true,
mcpConfigName: 'mcp.json', mcpConfigName: 'settings/mcp.json',
expectedPath: '.kiro/mcp.json' expectedPath: '.kiro/settings/mcp.json'
}, },
opencode: { opencode: {
mcpConfig: true, mcpConfig: true,