01394ed238
- 新增 scripts/check-generated-bindings.mjs 并接入 lint 与 ai-game-creator-shell:check:rust:crates:重跑 export_bindings 前后逐字节比对共享契约绑定。 - check:native-shells 的 AGC 边界改为负向门禁:渲染源码不得出现 fetch(/XHR/EventSource/sendBeacon/WebSocket/plugin-http,客户端 capability 不得授予 http:default。 - check-pingora-gateway-smoke 在 Windows 上找 pingora-gateway.exe,并修掉「API 并发保护」先关客户端连接再读响应的竞态。 - mobile-shell 三个 smoke 改成固定命令串启动 npm(绕开 npm.cmd EINVAL 与 DEP0190),desktop-shell 的 stage-release-binary 改用 fileURLToPath 修掉 F:\F:\… 路径拼接。 - vitest.config.ts 白名单补回现役根用例;三份 nginx 模板的 SPA allowlist 补回 /components 与 /design-system。
180 lines
6.8 KiB
TypeScript
180 lines
6.8 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,
|
|
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',
|
|
'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',
|
|
],
|
|
},
|
|
});
|