File tree Expand file tree Collapse file tree
packages/rstack/test/config/reload-app-config Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,3 +48,28 @@ define.app({
4848
4949 await expectFile ( dist2 ) ;
5050} , 30_000 ) ;
51+
52+ test ( 'should reload config when an imported file changes' , async ( { execCliAsync, logHelper } ) => {
53+ const configFile = path . join ( import . meta. dirname , 'test-temp-import.config.ts' ) ;
54+ const importedFile = path . join ( import . meta. dirname , 'test-temp-imported.ts' ) ;
55+
56+ await writeFile ( importedFile , '' ) ;
57+ await writeFile (
58+ configFile ,
59+ `import { define } from 'rstack';
60+ import './test-temp-imported.ts';
61+
62+ define.app({
63+ server: { port: ${ await getRandomPort ( ) } },
64+ });
65+ ` ,
66+ ) ;
67+
68+ execCliAsync ( 'dev --config test-temp-import.config.ts' ) ;
69+ await logHelper . expectBuildEnd ( ) ;
70+ logHelper . clearLogs ( ) ;
71+
72+ await writeFile ( importedFile , '// changed\n' ) ;
73+
74+ await logHelper . expectLog ( 'restarting server as test-temp-imported.ts changed' ) ;
75+ } , 30_000 ) ;
You can’t perform that action at this time.
0 commit comments