@@ -215,7 +215,7 @@ suite('BackupTracker', () => {
215215 tracker . dispose ( ) ;
216216 } ) ;
217217
218- test ( 'confirm onWillShutdown - no veto' , async function ( ) {
218+ test ( 'onWillShutdown - no veto if no dirty files ' , async function ( ) {
219219 const [ accessor , part , tracker ] = await createTracker ( ) ;
220220
221221 const resource = toResource . call ( this , '/path/index.txt' ) ;
@@ -224,18 +224,14 @@ suite('BackupTracker', () => {
224224 const event = new BeforeShutdownEventImpl ( ) ;
225225 accessor . lifecycleService . fireWillShutdown ( event ) ;
226226
227- const veto = event . value ;
228- if ( typeof veto === 'boolean' ) {
229- assert . ok ( ! veto ) ;
230- } else {
231- assert . ok ( ! ( await veto ) ) ;
232- }
227+ const veto = await event . value ;
228+ assert . ok ( ! veto ) ;
233229
234230 part . dispose ( ) ;
235231 tracker . dispose ( ) ;
236232 } ) ;
237233
238- test . skip ( 'confirm onWillShutdown - veto if user cancels', async function ( ) {
234+ test ( ' onWillShutdown - veto if user cancels (hot.exit: off) ', async function ( ) {
239235 const [ accessor , part , tracker ] = await createTracker ( ) ;
240236
241237 const resource = toResource . call ( this , '/path/index.txt' ) ;
@@ -244,6 +240,7 @@ suite('BackupTracker', () => {
244240 const model = accessor . textFileService . files . get ( resource ) ;
245241
246242 accessor . fileDialogService . setConfirmResult ( ConfirmResult . CANCEL ) ;
243+ accessor . filesConfigurationService . onFilesConfigurationChange ( { files : { hotExit : 'off' } } ) ;
247244
248245 await model ?. load ( ) ;
249246 model ?. textEditorModel ?. setValue ( 'foo' ) ;
@@ -252,12 +249,8 @@ suite('BackupTracker', () => {
252249 const event = new BeforeShutdownEventImpl ( ) ;
253250 accessor . lifecycleService . fireWillShutdown ( event ) ;
254251
255- const veto = event . value ;
256- if ( typeof veto === 'boolean' ) {
257- assert . ok ( veto ) ;
258- } else {
259- assert . ok ( ( await veto ) ) ;
260- }
252+ const veto = await event . value ;
253+ assert . ok ( veto ) ;
261254
262255 part . dispose ( ) ;
263256 tracker . dispose ( ) ;
@@ -278,20 +271,16 @@ suite('BackupTracker', () => {
278271 const event = new BeforeShutdownEventImpl ( ) ;
279272 accessor . lifecycleService . fireWillShutdown ( event ) ;
280273
281- const veto = event . value ;
282- if ( typeof veto === 'boolean' ) {
283- assert . ok ( ! veto ) ;
284- } else {
285- assert . ok ( ! ( await veto ) ) ;
286- }
274+ const veto = await event . value ;
275+ assert . ok ( ! veto ) ;
287276
288277 assert . equal ( accessor . workingCopyService . dirtyCount , 0 ) ;
289278
290279 part . dispose ( ) ;
291280 tracker . dispose ( ) ;
292281 } ) ;
293282
294- test ( 'confirm onWillShutdown - no veto and backups cleaned up if user does not want to save (hot.exit: off)' , async function ( ) {
283+ test ( 'onWillShutdown - no veto and backups cleaned up if user does not want to save (hot.exit: off)' , async function ( ) {
295284 const [ accessor , part , tracker ] = await createTracker ( ) ;
296285
297286 const resource = toResource . call ( this , '/path/index.txt' ) ;
@@ -308,21 +297,15 @@ suite('BackupTracker', () => {
308297 const event = new BeforeShutdownEventImpl ( ) ;
309298 accessor . lifecycleService . fireWillShutdown ( event ) ;
310299
311- let veto = event . value ;
312- if ( typeof veto === 'boolean' ) {
313- assert . ok ( accessor . backupFileService . discardedBackups . length > 0 ) ;
314- assert . ok ( ! veto ) ;
315- } else {
316- veto = await veto ;
317- assert . ok ( accessor . backupFileService . discardedBackups . length > 0 ) ;
318- assert . ok ( ! veto ) ;
319- }
300+ const veto = await event . value ;
301+ assert . ok ( ! veto ) ;
302+ assert . ok ( accessor . backupFileService . discardedBackups . length > 0 ) ;
320303
321304 part . dispose ( ) ;
322305 tracker . dispose ( ) ;
323306 } ) ;
324307
325- test ( 'confirm onWillShutdown - save (hot.exit: off)' , async function ( ) {
308+ test ( 'onWillShutdown - save (hot.exit: off)' , async function ( ) {
326309 const [ accessor , part , tracker ] = await createTracker ( ) ;
327310
328311 const resource = toResource . call ( this , '/path/index.txt' ) ;
@@ -339,7 +322,7 @@ suite('BackupTracker', () => {
339322 const event = new BeforeShutdownEventImpl ( ) ;
340323 accessor . lifecycleService . fireWillShutdown ( event ) ;
341324
342- const veto = await ( < Promise < boolean > > event . value ) ;
325+ const veto = await event . value ;
343326 assert . ok ( ! veto ) ;
344327 assert . ok ( ! model ?. isDirty ( ) ) ;
345328
@@ -482,7 +465,7 @@ suite('BackupTracker', () => {
482465 event . reason = shutdownReason ;
483466 accessor . lifecycleService . fireWillShutdown ( event ) ;
484467
485- const veto = await ( < Promise < boolean > > event . value ) ;
468+ const veto = await event . value ;
486469 assert . equal ( accessor . backupFileService . discardedBackups . length , 0 ) ; // When hot exit is set, backups should never be cleaned since the confirm result is cancel
487470 assert . equal ( veto , shouldVeto ) ;
488471
0 commit comments