@@ -32,6 +32,7 @@ suiteSetup(async () => {
3232} ) ;
3333
3434teardown ( async ( ) => {
35+ await workspace . getConfiguration ( 'oxc' ) . update ( 'lint.run' , undefined ) ;
3536 await workspace . getConfiguration ( 'oxc' ) . update ( 'flags' , undefined ) ;
3637 await workspace . getConfiguration ( 'oxc' ) . update ( 'tsConfigPath' , undefined ) ;
3738 await workspace . getConfiguration ( 'oxc' ) . update ( 'typeAware' , undefined ) ;
@@ -74,7 +75,6 @@ suite('E2E Diagnostics', () => {
7475 testSingleFolderMode ( 'detects diagnostics on run' , async ( ) =>
7576 {
7677 await loadFixture ( 'lint_on_run' ) ;
77- await sleep ( 250 ) ;
7878 const diagnostics = await getDiagnosticsWithoutClose ( `onType.ts` ) ;
7979 strictEqual ( diagnostics . length , 0 ) ;
8080
@@ -92,7 +92,6 @@ suite('E2E Diagnostics', () => {
9292
9393 test ( 'empty oxlint configuration behaves like default configuration' , async ( ) => {
9494 await loadFixture ( 'debugger_empty_config' ) ;
95- await sleep ( 250 ) ;
9695 const diagnostics = await getDiagnostics ( 'debugger.js' ) ;
9796
9897 strictEqual ( diagnostics . length , 1 ) ;
@@ -194,6 +193,39 @@ suite('E2E Diagnostics', () => {
194193 strictEqual ( nestedDiagnostics [ 0 ] . severity , DiagnosticSeverity . Error ) ;
195194 } ) ;
196195
196+
197+ test ( 'setting `oxc.lint.run` to `off` clears diagnostics' , async ( ) => {
198+ await workspace . getConfiguration ( 'oxc' ) . update ( 'lint.run' , undefined ) ;
199+ await loadFixture ( 'disabling_lint' ) ;
200+ await sleep ( 250 ) ;
201+ const firstDiagnostics = await getDiagnosticsWithoutClose ( 'debugger.js' ) ;
202+
203+ strictEqual ( firstDiagnostics . length , 1 ) ;
204+
205+ await workspace . getConfiguration ( 'oxc' ) . update ( 'lint.run' , 'off' ) ;
206+ await workspace . saveAll ( ) ;
207+ await waitForDiagnosticChange ( ) ;
208+
209+ const secondDiagnostics = await getDiagnostics ( 'debugger.js' ) ;
210+ strictEqual ( secondDiagnostics . length , 0 ) ;
211+ } ) ;
212+
213+ test ( 'setting `oxc.lint.run` from `off` to `onType`, shows the diagnostics' , async ( ) => {
214+ await workspace . getConfiguration ( 'oxc' ) . update ( 'lint.run' , "off" ) ;
215+ await loadFixture ( 'disabling_lint' ) ;
216+ await sleep ( 250 ) ;
217+ const firstDiagnostics = await getDiagnosticsWithoutClose ( 'debugger.js' ) ;
218+
219+ strictEqual ( firstDiagnostics . length , 0 ) ;
220+
221+ await workspace . getConfiguration ( 'oxc' ) . update ( 'lint.run' , 'onType' ) ;
222+ await workspace . saveAll ( ) ;
223+ await waitForDiagnosticChange ( ) ;
224+
225+ const secondDiagnostics = await getDiagnostics ( 'debugger.js' ) ;
226+ strictEqual ( secondDiagnostics . length , 1 ) ;
227+ } ) ;
228+
197229 // somehow this test is flaky in CI
198230 // testMultiFolderMode('different diagnostic severity', async () => {
199231 // await loadFixture('debugger', WORKSPACE_DIR);
0 commit comments