@@ -64,19 +64,35 @@ describe('Integration >', () => {
64
64
65
65
it ( 'updates diagnostics when files are deleted' , async ( ) => {
66
66
const markdownContent = await workspace . fs . readFile ( markdownUri ) ;
67
- // `harper-ls` can only be notified if the deletion happens within VSCode, so use these
68
- // commands instead of `workspace.fs.delete`.
67
+
68
+ // Delete file through VSCode
69
69
await commands . executeCommand ( 'workbench.files.action.showActiveFileInExplorer' ) ;
70
70
await commands . executeCommand ( 'deleteFile' ) ;
71
71
// Wait for `harper-ls` to update diagnostics
72
+ await sleep ( 450 ) ;
73
+
74
+ compareActualVsExpectedDiagnostics (
75
+ getActualDiagnostics ( markdownUri ) ,
76
+ createExpectedDiagnostics ( )
77
+ ) ;
78
+
79
+ // Restore and reopen deleted file
80
+ await workspace . fs . writeFile ( markdownUri , markdownContent ) ;
81
+ await openFile ( 'integration.md' ) ;
82
+ // Wait for `harper-ls` to update diagnostics
72
83
await sleep ( 75 ) ;
73
84
85
+ // Delete file directly
86
+ await workspace . fs . delete ( markdownUri ) ;
87
+ // Wait for `harper-ls` to update diagnostics
88
+ await sleep ( 450 ) ;
89
+
74
90
compareActualVsExpectedDiagnostics (
75
91
getActualDiagnostics ( markdownUri ) ,
76
92
createExpectedDiagnostics ( )
77
93
) ;
78
94
79
- // Re-create deleted file and open it again
95
+ // Restore and reopen deleted file
80
96
await workspace . fs . writeFile ( markdownUri , markdownContent ) ;
81
97
await openFile ( 'integration.md' ) ;
82
98
} ) ;
0 commit comments