chore: standardize config and fix component test mocks

- Replace .eslintrc.json with .eslintrc.js (standard @headlamp-k8s/eslint-config)
- Create .prettierrc.js (standard Headlamp prettier config)
- Add .headlamp-plugin/, .env, .env.local, .eslintcache to .gitignore
- Remove .claude/settings.json and .claude/settings.local.json from .gitignore
- Create .claude/settings.local.json with enabled MCP servers
- Remove "Subagent guidance" section and hardcoded test count from CLAUDE.md
- Fix 8 component test files: replace require('./__mocks__/commonComponents.ts')
  with await import('./__mocks__/commonComponents') in vi.mock factories —
  require() cannot process TypeScript in hoisted mock context

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
DevContainer User
2026-03-03 21:30:55 +00:00
parent e2512ec500
commit 06d18a3eb3
15 changed files with 37 additions and 81 deletions
+2 -2
View File
@@ -13,8 +13,8 @@ vi.mock('@kinvolk/headlamp-plugin/lib', () => ({
},
}));
vi.mock('@kinvolk/headlamp-plugin/lib/CommonComponents', () =>
require('./__mocks__/commonComponents.ts')
vi.mock('@kinvolk/headlamp-plugin/lib/CommonComponents', async () =>
await import('./__mocks__/commonComponents')
);
vi.mock('../api/TnsCsiDataContext');
+2 -2
View File
@@ -1,8 +1,8 @@
import { render, screen } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest';
vi.mock('@kinvolk/headlamp-plugin/lib/CommonComponents', () =>
require('./__mocks__/commonComponents.ts')
vi.mock('@kinvolk/headlamp-plugin/lib/CommonComponents', async () =>
await import('./__mocks__/commonComponents')
);
import DriverStatusCard from './DriverStatusCard';
+2 -2
View File
@@ -1,8 +1,8 @@
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import { describe, expect, it, vi, beforeEach } from 'vitest';
vi.mock('@kinvolk/headlamp-plugin/lib/CommonComponents', () =>
require('./__mocks__/commonComponents.ts')
vi.mock('@kinvolk/headlamp-plugin/lib/CommonComponents', async () =>
await import('./__mocks__/commonComponents')
);
vi.mock('../api/TnsCsiDataContext');
+2 -2
View File
@@ -1,8 +1,8 @@
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import { describe, expect, it, vi, beforeEach } from 'vitest';
vi.mock('@kinvolk/headlamp-plugin/lib/CommonComponents', () =>
require('./__mocks__/commonComponents.ts')
vi.mock('@kinvolk/headlamp-plugin/lib/CommonComponents', async () =>
await import('./__mocks__/commonComponents')
);
vi.mock('../api/TnsCsiDataContext');
+2 -2
View File
@@ -1,8 +1,8 @@
import { render, screen } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest';
vi.mock('@kinvolk/headlamp-plugin/lib/CommonComponents', () =>
require('./__mocks__/commonComponents.ts')
vi.mock('@kinvolk/headlamp-plugin/lib/CommonComponents', async () =>
await import('./__mocks__/commonComponents')
);
vi.mock('../api/TnsCsiDataContext');
+2 -2
View File
@@ -1,8 +1,8 @@
import { render, screen } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest';
vi.mock('@kinvolk/headlamp-plugin/lib/CommonComponents', () =>
require('./__mocks__/commonComponents.ts')
vi.mock('@kinvolk/headlamp-plugin/lib/CommonComponents', async () =>
await import('./__mocks__/commonComponents')
);
vi.mock('../api/TnsCsiDataContext');
+2 -2
View File
@@ -1,8 +1,8 @@
import { fireEvent, render, screen } from '@testing-library/react';
import { describe, expect, it, vi, beforeEach } from 'vitest';
vi.mock('@kinvolk/headlamp-plugin/lib/CommonComponents', () =>
require('./__mocks__/commonComponents.ts')
vi.mock('@kinvolk/headlamp-plugin/lib/CommonComponents', async () =>
await import('./__mocks__/commonComponents')
);
let mockHash = '';
+2 -2
View File
@@ -1,8 +1,8 @@
import { fireEvent, render, screen } from '@testing-library/react';
import { describe, expect, it, vi, beforeEach } from 'vitest';
vi.mock('@kinvolk/headlamp-plugin/lib/CommonComponents', () =>
require('./__mocks__/commonComponents.ts')
vi.mock('@kinvolk/headlamp-plugin/lib/CommonComponents', async () =>
await import('./__mocks__/commonComponents')
);
let mockHash = '';