fix(frontend): remove test types from base tsconfig for CI build
The base tsconfig.json had types: ["vitest/globals", "@testing-library/jest-dom/vitest"] which are devDependencies only installed during development. CI production builds with npm ci --production don't include these, causing TS2688 errors. Solution: Remove types array from tsconfig.json (let TS auto-discover available types) Simplify tsconfig.build.json to only exclude test files Add triple-slash type references to test setup file Add typecheck config to vitest.config.ts This ensures: Production builds work without devDependencies Test files still have proper type definitions No JSX.IntrinsicElements errors from missing React types
This commit is contained in:
@@ -37,8 +37,8 @@ describe('useCredentials', () => {
|
||||
const mockCredentials = [
|
||||
{ id: 1, label: 'Test', zone_filter: 'example.com' },
|
||||
{ id: 2, label: 'Test2', zone_filter: '*.test.com' },
|
||||
]
|
||||
vi.mocked(credentialsApi.getCredentials).mockResolvedValue(mockCredentials as any)
|
||||
] as Awaited<ReturnType<typeof credentialsApi.getCredentials>>
|
||||
vi.mocked(credentialsApi.getCredentials).mockResolvedValue(mockCredentials)
|
||||
|
||||
const { result } = renderHook(() => useCredentials(1), { wrapper: createWrapper() })
|
||||
|
||||
@@ -64,8 +64,8 @@ describe('useCredentials', () => {
|
||||
|
||||
describe('useCredential', () => {
|
||||
it('fetches a single credential', async () => {
|
||||
const mockCredential = { id: 1, label: 'Test', zone_filter: 'example.com' }
|
||||
vi.mocked(credentialsApi.getCredential).mockResolvedValue(mockCredential as any)
|
||||
const mockCredential = { id: 1, label: 'Test', zone_filter: 'example.com' } as Awaited<ReturnType<typeof credentialsApi.getCredential>>
|
||||
vi.mocked(credentialsApi.getCredential).mockResolvedValue(mockCredential)
|
||||
|
||||
const { result } = renderHook(() => useCredential(1, 1), { wrapper: createWrapper() })
|
||||
|
||||
@@ -85,8 +85,8 @@ describe('useCredentials', () => {
|
||||
|
||||
describe('useCreateCredential', () => {
|
||||
it('creates a credential and invalidates queries', async () => {
|
||||
const mockCredential = { id: 3, label: 'New', zone_filter: 'new.com' }
|
||||
vi.mocked(credentialsApi.createCredential).mockResolvedValue(mockCredential as any)
|
||||
const mockCredential = { id: 3, label: 'New', zone_filter: 'new.com' } as Awaited<ReturnType<typeof credentialsApi.createCredential>>
|
||||
vi.mocked(credentialsApi.createCredential).mockResolvedValue(mockCredential)
|
||||
|
||||
const { result } = renderHook(() => useCreateCredential(), { wrapper: createWrapper() })
|
||||
|
||||
@@ -122,8 +122,8 @@ describe('useCredentials', () => {
|
||||
|
||||
describe('useUpdateCredential', () => {
|
||||
it('updates a credential and invalidates queries', async () => {
|
||||
const mockCredential = { id: 1, label: 'Updated', zone_filter: 'updated.com' }
|
||||
vi.mocked(credentialsApi.updateCredential).mockResolvedValue(mockCredential as any)
|
||||
const mockCredential = { id: 1, label: 'Updated', zone_filter: 'updated.com' } as Awaited<ReturnType<typeof credentialsApi.updateCredential>>
|
||||
vi.mocked(credentialsApi.updateCredential).mockResolvedValue(mockCredential)
|
||||
|
||||
const { result } = renderHook(() => useUpdateCredential(), { wrapper: createWrapper() })
|
||||
|
||||
|
||||
@@ -12,10 +12,11 @@ export function useDocker(host?: string | null, serverId?: string | null) {
|
||||
queryFn: async () => {
|
||||
try {
|
||||
return await dockerApi.listContainers(host || undefined, serverId || undefined)
|
||||
} catch (err: any) {
|
||||
} catch (err: unknown) {
|
||||
// Extract helpful error message from response
|
||||
if (err.response?.status === 503) {
|
||||
const details = err.response?.data?.details
|
||||
const error = err as { response?: { status?: number; data?: { details?: string } } }
|
||||
if (error.response?.status === 503) {
|
||||
const details = error.response?.data?.details
|
||||
const message = details || 'Docker service unavailable. Check that Docker is running.'
|
||||
throw new Error(message)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user