8e304f2b22
Project CI / Backend tests (pull_request) Failing after 35s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 2m37s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 6m43s
Project CI / Repository checks (pull_request) Failing after 26s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 4m46s
Project CI / Frontend tests (pull_request) Successful in 2m50s
Project CI / AI game creator shell web tests (pull_request) Successful in 2m9s
Project CI / Native shell tests (pull_request) Successful in 5m44s
187 lines
7.4 KiB
TypeScript
187 lines
7.4 KiB
TypeScript
import { createRequire } from 'node:module';
|
|
import path from 'node:path';
|
|
|
|
import { defineConfig } from 'vitest/config';
|
|
|
|
const aiGameCreatorRequire = createRequire(
|
|
path.resolve(__dirname, 'apps/ai-game-creator-shell/package.json'),
|
|
);
|
|
const reactFileManagerPackageRoot = path.dirname(
|
|
aiGameCreatorRequire.resolve('@cubone/react-file-manager/package.json'),
|
|
);
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: [
|
|
{
|
|
find: /^@genarrative\/shared\/components$/,
|
|
replacement: path.resolve(
|
|
__dirname,
|
|
'packages/shared/src/components/index.ts',
|
|
),
|
|
},
|
|
{
|
|
find: /^@cubone\/react-file-manager$/,
|
|
replacement: path.resolve(
|
|
reactFileManagerPackageRoot,
|
|
'dist/react-file-manager.es.js',
|
|
),
|
|
},
|
|
// Keep shared components' application-root imports resolvable in tests.
|
|
{ find: '@', replacement: path.resolve(__dirname, '.') },
|
|
// worktree 复用依赖时,共享包仍须解析到当前检出的源码。
|
|
{
|
|
find: '@genarrative/shared/components/account',
|
|
replacement: path.resolve(
|
|
__dirname,
|
|
'packages/shared/src/components/account.ts',
|
|
),
|
|
},
|
|
{
|
|
find: '@genarrative/shared/components',
|
|
replacement: path.resolve(__dirname, 'packages/shared/src/components'),
|
|
},
|
|
{
|
|
find: '@genarrative/shared/lib',
|
|
replacement: path.resolve(__dirname, 'packages/shared/src/lib'),
|
|
},
|
|
{
|
|
find: /^@genarrative\/shared$/,
|
|
replacement: path.resolve(__dirname, 'packages/shared/src/index.ts'),
|
|
},
|
|
{
|
|
find: '@genarrative/image-canvas-core',
|
|
replacement: path.resolve(
|
|
__dirname,
|
|
'packages/image-canvas-core/src/index.ts',
|
|
),
|
|
},
|
|
{
|
|
find: '@genarrative/image-canvas-react',
|
|
replacement: path.resolve(
|
|
__dirname,
|
|
'packages/image-canvas-react/src/index.ts',
|
|
),
|
|
},
|
|
// The standalone AI shell owns its Tauri guest dependencies. Root tests
|
|
// use inert aliases so the root H5 package keeps the HostBridge boundary.
|
|
{
|
|
find: '@tauri-apps/plugin-clipboard-manager',
|
|
replacement: path.resolve(
|
|
__dirname,
|
|
'apps/ai-game-creator-shell/tests/tauri-plugin-clipboard-manager.mock.ts',
|
|
),
|
|
},
|
|
{
|
|
find: '@tauri-apps/plugin-opener',
|
|
replacement: path.resolve(
|
|
__dirname,
|
|
'apps/ai-game-creator-shell/tests/tauri-plugin-opener.mock.ts',
|
|
),
|
|
},
|
|
// Keep every workspace test on the root install's single React renderer.
|
|
{
|
|
find: 'react',
|
|
replacement: path.resolve(__dirname, 'node_modules/react'),
|
|
},
|
|
{
|
|
find: 'react-dom',
|
|
replacement: path.resolve(__dirname, 'node_modules/react-dom'),
|
|
},
|
|
],
|
|
dedupe: ['react', 'react-dom', 'zustand'],
|
|
},
|
|
test: {
|
|
environment: 'node',
|
|
globals: true,
|
|
// 成功用例不回放被测代码写进 stdout / stderr 的内容:CI 日志里只保留每个
|
|
// 失败用例的断言摘要,避免 React act 警告、dev 调度日志这类噪音刷屏。
|
|
// 需要在本机排查时用 `vitest run --silent=false` 覆盖本次配置。
|
|
silent: true,
|
|
minThreads: 1,
|
|
maxThreads: 8,
|
|
server: {
|
|
deps: {
|
|
inline: [
|
|
/apps\/ai-game-creator-shell\/node_modules\//,
|
|
/node_modules\/@cubone\/react-file-manager/,
|
|
],
|
|
},
|
|
},
|
|
include: [
|
|
'src/index.test.ts',
|
|
'src/config/**/*.test.ts',
|
|
'src/routing/activeAppPageRoutes.test.ts',
|
|
'src/routing/activeAppRoutes.test.ts',
|
|
'src/routing/RouteImageReadyGate.test.ts',
|
|
'src/persistence/**/*.test.ts',
|
|
'src/editor/shared/jsonClient.test.ts',
|
|
'src/services/activeAppTitle.test.ts',
|
|
'src/services/gameDistributionClient.test.ts',
|
|
'src/services/assetReadUrlService.test.ts',
|
|
'src/services/authService.test.ts',
|
|
'src/services/apiClient.test.ts',
|
|
'src/services/clipboard.test.ts',
|
|
'src/services/frontendRuntimeConfigService.test.ts',
|
|
'src/services/sseStream.test.ts',
|
|
'src/services/host-bridge/**/*.test.ts',
|
|
'src/services/image-editor/**/*.test.ts',
|
|
'src/services/external-generation/**/*.test.ts',
|
|
'src/services/payment/**/*.test.ts',
|
|
'src/services/platform-entry/platformProfileClient.test.ts',
|
|
'src/stores/**/*.test.ts',
|
|
'src/stores/**/*.test.tsx',
|
|
'src/components/auth/**/*.test.ts',
|
|
'src/components/auth/**/*.test.tsx',
|
|
'src/components/creation-home/**/*.test.ts',
|
|
'src/components/creation-home/**/*.test.tsx',
|
|
'src/components/game-distribution/**/*.test.ts',
|
|
'src/components/game-distribution/**/*.test.tsx',
|
|
'src/components/shared-components/**/*.test.tsx',
|
|
'src/components/common/AutoGrowTextArea.test.tsx',
|
|
'src/components/common/CreativeImageInputPanel.test.tsx',
|
|
'src/components/common/PlatformDangerConfirmDialog.test.tsx',
|
|
'src/components/common/PlatformFloatingMenu.test.tsx',
|
|
'src/components/common/PlatformImagePreviewModal.test.tsx',
|
|
'src/components/common/PlatformReportDialog.test.tsx',
|
|
'src/components/common/PlatformUtilityInfoModal.test.tsx',
|
|
'src/components/common/PublishShareModal.test.tsx',
|
|
'src/components/image-editor/**/*.test.ts',
|
|
'src/components/image-editor/**/*.test.tsx',
|
|
'src/components/project/**/*.test.ts',
|
|
'src/components/project/**/*.test.tsx',
|
|
'src/components/platform-entry/PlatformActiveMobileWelcomeDialog.test.tsx',
|
|
'src/components/platform-entry/PlatformActiveProfileView.test.tsx',
|
|
'src/components/platform-entry/PlatformEntryActiveFlowShell.test.tsx',
|
|
'src/components/platform-entry/PlatformProfileModalShell.test.tsx',
|
|
'src/components/platform-entry/PlatformProfileReferralModal.test.tsx',
|
|
'src/components/platform-entry/PlatformProfileRewardCodeRedeemModal.test.tsx',
|
|
'src/components/platform-entry/platformProfile*.test.ts',
|
|
'src/components/platform-entry/usePlatformProfileCenterController*.test.tsx',
|
|
'src/components/platform-entry/PlatformProfilePrimitives.test.tsx',
|
|
'src/hooks/useHostNavigationCanGoBack.test.tsx',
|
|
'src/hooks/useResolvedAssetReadUrl.test.tsx',
|
|
'apps/admin-web/src/**/*.test.ts',
|
|
'apps/admin-web/src/**/*.test.tsx',
|
|
'apps/ai-game-creator-shell/tests/**/*.test.ts',
|
|
'apps/ai-game-creator-shell/tests/**/*.test.tsx',
|
|
'apps/ai-game-creator-shell/src/features/ui-editor/utils/transform/tf2css.test.tsx',
|
|
// DirectProject 会话滚动的判据与 hook 与实现同目录:改滚动契约时用例就在旁边。
|
|
'apps/ai-game-creator-shell/src/view/project-development/chat/**/*.test.ts',
|
|
'apps/ai-game-creator-shell/src/view/project-development/chat/**/*.test.tsx',
|
|
'miniprogram/**/*.test.js',
|
|
'scripts/**/*.test.ts',
|
|
'packages/shared/src/contracts/*.test.ts',
|
|
'packages/shared/src/theme.test.ts',
|
|
'packages/shared/src/components/**/*.test.ts',
|
|
'packages/shared/src/components/**/*.test.tsx',
|
|
'packages/shared/src/stores/**/*.test.ts',
|
|
'packages/shared/src/utils/**/*.test.ts',
|
|
'packages/image-canvas-core/src/**/*.test.ts',
|
|
'packages/image-canvas-react/src/**/*.test.ts',
|
|
'packages/image-canvas-react/src/**/*.test.tsx',
|
|
'packages/agc-plugin-sdk/src/**/*.test.ts',
|
|
],
|
|
},
|
|
});
|