@@ -1183,32 +1183,36 @@ test('creates a plugin file in cwd when no explicit path is provided', async ({
11831183 page,
11841184 tmpPath
11851185} ) => {
1186- const cwd = `${ tmpPath } /nested` ;
1187- await page . contents . uploadContent ( 'seed\n' , 'text' , `${ cwd } /seed.txt` ) ;
1186+ try {
1187+ const cwd = `${ tmpPath } /nested` ;
1188+ await page . contents . uploadContent ( 'seed\n' , 'text' , `${ cwd } /seed.txt` ) ;
11881189
1189- await page . goto ( ) ;
1190- await page . waitForCondition ( ( ) =>
1191- page . evaluate ( ( id : string ) => {
1192- return window . jupyterapp . commands . hasCommand ( id ) ;
1193- } , CREATE_FILE_COMMAND )
1194- ) ;
1190+ await page . goto ( ) ;
1191+ await page . waitForCondition ( ( ) =>
1192+ page . evaluate ( ( id : string ) => {
1193+ return window . jupyterapp . commands . hasCommand ( id ) ;
1194+ } , CREATE_FILE_COMMAND )
1195+ ) ;
11951196
1196- const openPath = await page . evaluate (
1197- async ( { id, cwdArg } ) => {
1198- await window . jupyterapp . commands . execute ( id , { cwd : cwdArg } ) ;
1199- const current = window . jupyterapp . shell
1200- . currentWidget as FileEditorWidget | null ;
1201- return current ?. context ?. path ?? null ;
1202- } ,
1203- {
1204- id : CREATE_FILE_COMMAND ,
1205- cwdArg : cwd
1206- }
1207- ) ;
1197+ const openPath = await page . evaluate (
1198+ async ( { id, cwdArg } ) => {
1199+ await window . jupyterapp . commands . execute ( id , { cwd : cwdArg } ) ;
1200+ const current = window . jupyterapp . shell
1201+ . currentWidget as FileEditorWidget | null ;
1202+ return current ?. context ?. path ?? null ;
1203+ } ,
1204+ {
1205+ id : CREATE_FILE_COMMAND ,
1206+ cwdArg : cwd
1207+ }
1208+ ) ;
12081209
1209- expect ( openPath ) . toBeTruthy ( ) ;
1210- expect ( openPath ?. startsWith ( `${ cwd } /` ) ) . toBe ( true ) ;
1211- expect ( openPath ?. endsWith ( '.ts' ) ) . toBe ( true ) ;
1210+ expect ( openPath ) . toBeTruthy ( ) ;
1211+ expect ( openPath ?. startsWith ( `${ cwd } /` ) ) . toBe ( true ) ;
1212+ expect ( openPath ?. endsWith ( '.ts' ) ) . toBe ( true ) ;
1213+ } finally {
1214+ await page . unrouteAll ( { behavior : 'ignoreErrors' } ) ;
1215+ }
12121216} ) ;
12131217
12141218test ( 'lists tokens and searches commands via command APIs' , async ( {
0 commit comments