@@ -4,6 +4,30 @@ import * as NodeURL from "node:url";
44
55const DOM_TEST_ENVIRONMENT_ALLOWLIST : Array < string > = [ ] ;
66
7+ const TEST_EXCLUDE = [
8+ "**/.repos/**" ,
9+ "**/.t3/**" ,
10+ "**/node_modules/**" ,
11+ "**/dist/**" ,
12+ "**/dist-electron/**" ,
13+ "**/.{idea,git,cache,output,temp}/**" ,
14+ ] ;
15+
16+ // Directories whose tests belong to a package's own test config. desktop also
17+ // owns the kde-snap-shot tests through its `include`.
18+ const TEST_CONFIG_PACKAGES = [
19+ "apps/desktop" ,
20+ "apps/mobile" ,
21+ "apps/server" ,
22+ "apps/web" ,
23+ "packages/client-runtime" ,
24+ ] ;
25+
26+ // `vp test run <file>` from the repo root hands each file to its package's
27+ // config. Packages that borrow this config (`--config ../../vite.config.ts`) run
28+ // from their own directory, as CI does, so they keep one plain project.
29+ const isRepoRootTestRun = process . cwd ( ) === import . meta. dirname ;
30+
731const RESTRICTED_IMPORT_PATHS = [
832 {
933 name : "@t3tools/client-runtime" ,
@@ -56,14 +80,7 @@ export default defineConfig({
5680 } ,
5781 test : {
5882 environment : "node" ,
59- exclude : [
60- "**/.repos/**" ,
61- "**/.t3/**" ,
62- "**/node_modules/**" ,
63- "**/dist/**" ,
64- "**/dist-electron/**" ,
65- "**/.{idea,git,cache,output,temp}/**" ,
66- ] ,
83+ exclude : TEST_EXCLUDE ,
6784 hookTimeout : 60_000 ,
6885 testTimeout : 60_000 ,
6986 allowOnly : ! process . env . CI ,
@@ -89,7 +106,28 @@ export default defineConfig({
89106 NodeURL . fileURLToPath (
90107 new URL ( "./packages/shared/src/testing/longTempDir.ts" , import . meta. url ) ,
91108 ) ,
109+ NodeURL . fileURLToPath (
110+ new URL ( "./packages/shared/src/testing/providerEnv.ts" , import . meta. url ) ,
111+ ) ,
92112 ] ,
113+ ...( isRepoRootTestRun
114+ ? {
115+ projects : [
116+ ...TEST_CONFIG_PACKAGES ,
117+ {
118+ extends : true ,
119+ test : {
120+ name : "root" ,
121+ exclude : [
122+ ...TEST_EXCLUDE ,
123+ ...TEST_CONFIG_PACKAGES . map ( ( dir ) => `${ dir } /**` ) ,
124+ "native/kde-snap-shot/**" ,
125+ ] ,
126+ } ,
127+ } ,
128+ ] ,
129+ }
130+ : { } ) ,
93131 } ,
94132 staged : {
95133 "*" : "vp fmt --no-error-on-unmatched-pattern" ,
0 commit comments