@@ -82,3 +82,64 @@ define.app({
8282 'restarting server as test-temp-imported.ts changed' ,
8383 ) ;
8484} ) ;
85+
86+ test ( 'should reload config when an imported shared config changes' , async ( {
87+ execCliAsync,
88+ logHelper,
89+ expect,
90+ } ) => {
91+ const configFile = path . join (
92+ import . meta. dirname ,
93+ 'test-temp-shared.config.ts' ,
94+ ) ;
95+ const importedFile = path . join ( import . meta. dirname , 'test-temp-shared.ts' ) ;
96+ const port = await getRandomPort ( ) ;
97+ const url = `http://localhost:${ port } ` ;
98+
99+ await writeFile (
100+ importedFile ,
101+ `export const sharedConfig = {
102+ app: {
103+ html: { title: 'before import change' },
104+ },
105+ };
106+ ` ,
107+ ) ;
108+ await writeFile (
109+ configFile ,
110+ `import { define } from 'rstack';
111+ import { sharedConfig } from './test-temp-shared.ts';
112+
113+ define.extends([sharedConfig]);
114+
115+ define.app({
116+ server: { port: ${ port } },
117+ });
118+ ` ,
119+ ) ;
120+
121+ execCliAsync ( 'dev --config test-temp-shared.config.ts' ) ;
122+ await logHelper . expectBuildEnd ( ) ;
123+ const initialResponse = await fetch ( url ) ;
124+ expect ( await initialResponse . text ( ) ) . toContain (
125+ '<title>before import change</title>' ,
126+ ) ;
127+ logHelper . clearLogs ( ) ;
128+
129+ await writeFile (
130+ importedFile ,
131+ `export const sharedConfig = {
132+ app: {
133+ html: { title: 'after import change' },
134+ },
135+ };
136+ ` ,
137+ ) ;
138+
139+ await logHelper . expectLog ( 'restarting server as test-temp-shared.ts changed' ) ;
140+ await logHelper . expectBuildEnd ( ) ;
141+ const updatedResponse = await fetch ( url ) ;
142+ expect ( await updatedResponse . text ( ) ) . toContain (
143+ '<title>after import change</title>' ,
144+ ) ;
145+ } ) ;
0 commit comments