@@ -80,8 +80,6 @@ suite('Interactive window command listener', async () => {
80
80
const server = createTypeMoq < INotebookServer > ( 'jupyter server' ) ;
81
81
let lastFileContents : any ;
82
82
83
- setup ( createCommandListener ) ;
84
-
85
83
teardown ( ( ) => {
86
84
documentManager . activeTextEditor = undefined ;
87
85
lastFileContents = undefined ;
@@ -216,15 +214,18 @@ suite('Interactive window command listener', async () => {
216
214
}
217
215
218
216
test ( 'Import' , async ( ) => {
217
+ createCommandListener ( ) ;
219
218
when ( applicationShell . showOpenDialog ( argThat ( o => o . openLabel && o . openLabel . includes ( 'Import' ) ) ) ) . thenReturn ( Promise . resolve ( [ Uri . file ( 'foo' ) ] ) ) ;
220
219
await commandManager . executeCommand ( Commands . ImportNotebook , undefined , undefined ) ;
221
220
assert . ok ( documentManager . activeTextEditor , 'Imported file was not opened' ) ;
222
221
} ) ;
223
222
test ( 'Import File' , async ( ) => {
223
+ createCommandListener ( ) ;
224
224
await commandManager . executeCommand ( Commands . ImportNotebook , Uri . file ( 'bar.ipynb' ) , undefined ) ;
225
225
assert . ok ( documentManager . activeTextEditor , 'Imported file was not opened' ) ;
226
226
} ) ;
227
227
test ( 'Export File' , async ( ) => {
228
+ createCommandListener ( ) ;
228
229
const doc = await documentManager . openTextDocument ( 'bar.ipynb' ) ;
229
230
await documentManager . showTextDocument ( doc ) ;
230
231
when ( applicationShell . showSaveDialog ( argThat ( o => o . saveLabel && o . saveLabel . includes ( 'Export' ) ) ) ) . thenReturn ( Promise . resolve ( Uri . file ( 'foo' ) ) ) ;
@@ -238,6 +239,7 @@ suite('Interactive window command listener', async () => {
238
239
verify ( applicationShell . showInformationMessage ( anything ( ) , localize . DataScience . exportOpenQuestion1 ( ) , localize . DataScience . exportOpenQuestion ( ) ) ) . once ( ) ;
239
240
} ) ;
240
241
test ( 'Export File and output' , async ( ) => {
242
+ createCommandListener ( ) ;
241
243
const doc = await documentManager . openTextDocument ( 'bar.ipynb' ) ;
242
244
await documentManager . showTextDocument ( doc ) ;
243
245
when ( jupyterExecution . connectToNotebookServer ( anything ( ) , anything ( ) ) ) . thenResolve ( server . object ) ;
@@ -258,11 +260,13 @@ suite('Interactive window command listener', async () => {
258
260
verify ( applicationShell . showInformationMessage ( anything ( ) , localize . DataScience . exportOpenQuestion1 ( ) , localize . DataScience . exportOpenQuestion ( ) ) ) . once ( ) ;
259
261
} ) ;
260
262
test ( 'Export skipped on no file' , async ( ) => {
263
+ createCommandListener ( ) ;
261
264
when ( applicationShell . showSaveDialog ( argThat ( o => o . saveLabel && o . saveLabel . includes ( 'Export' ) ) ) ) . thenReturn ( Promise . resolve ( Uri . file ( 'foo' ) ) ) ;
262
265
await commandManager . executeCommand ( Commands . ExportFileAndOutputAsNotebook , Uri . file ( 'bar.ipynb' ) ) ;
263
266
assert . notExists ( lastFileContents , 'Export file was written to' ) ;
264
267
} ) ;
265
268
test ( 'Export happens on no file' , async ( ) => {
269
+ createCommandListener ( ) ;
266
270
const doc = await documentManager . openTextDocument ( 'bar.ipynb' ) ;
267
271
await documentManager . showTextDocument ( doc ) ;
268
272
when ( applicationShell . showSaveDialog ( argThat ( o => o . saveLabel && o . saveLabel . includes ( 'Export' ) ) ) ) . thenReturn ( Promise . resolve ( Uri . file ( 'foo' ) ) ) ;
0 commit comments