mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
fix(tests): resolve 4 vitest failure categories in nextjs frontend
- Fix vitest.config.ts fakemui alias path: ../../fakemui → ../../components/fakemui
(matches tsconfig.json paths; fixes pagination + get-component-icon tests)
- Add vi.mock('server-only') to route.test.ts to prevent server-only guard
throwing in jsdom environment
- Replace @jest/globals with vitest in workflow-error-handler and
multi-tenant-context test files
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,9 @@
|
||||
* Integration tests verify full DBAL execution
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { describe, it, expect, vi } from 'vitest'
|
||||
|
||||
vi.mock('server-only', () => ({}))
|
||||
|
||||
describe('API Route /api/v1/[...slug]', () => {
|
||||
describe('Route structure', () => {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* - Security validations
|
||||
*/
|
||||
|
||||
import { describe, it, expect, beforeEach } from '@jest/globals'
|
||||
import { describe, it, expect, beforeEach } from 'vitest'
|
||||
import {
|
||||
MultiTenantContextBuilder,
|
||||
createContextFromRequest,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* - Recovery suggestions and hints
|
||||
*/
|
||||
|
||||
import { describe, it, expect, beforeEach } from '@jest/globals'
|
||||
import { describe, it, expect, beforeEach } from 'vitest'
|
||||
import {
|
||||
WorkflowErrorHandler,
|
||||
WorkflowErrorCode,
|
||||
|
||||
@@ -16,7 +16,7 @@ export default defineConfig({
|
||||
// Use inline to avoid duplicate React instances in tests
|
||||
optimizer: {
|
||||
web: {
|
||||
include: ['@/fakemui', 'react', 'react-dom']
|
||||
include: ['react', 'react-dom']
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,8 +25,8 @@ export default defineConfig({
|
||||
dedupe: ['react', 'react-dom'],
|
||||
alias: [
|
||||
// fakemui aliases must be first (more specific matches first)
|
||||
{ find: /^@\/fakemui\/(.+)$/, replacement: resolve(__dirname, '../../fakemui/$1') },
|
||||
{ find: /^@\/fakemui$/, replacement: resolve(__dirname, '../../fakemui/index.ts') },
|
||||
{ find: /^@\/fakemui\/(.+)$/, replacement: resolve(__dirname, '../../components/fakemui/$1') },
|
||||
{ find: /^@\/fakemui$/, replacement: resolve(__dirname, '../../components/fakemui/index.ts') },
|
||||
// dbal-ui alias for shared UI components
|
||||
{ find: /^@dbal-ui\/(.+)$/, replacement: resolve(__dirname, '../../dbal/shared/ui/$1') },
|
||||
{ find: /^@dbal-ui$/, replacement: resolve(__dirname, '../../dbal/shared/ui') },
|
||||
|
||||
Reference in New Issue
Block a user