@@ -5,6 +5,11 @@ import {
55 writeOxlintFixture ,
66} from './oxlint-test-utils.js'
77
8+ async function cleanupFixture ( fixture ) {
9+ // oxlint-disable-next-line epic-web/no-manual-dispose
10+ await fixture [ Symbol . asyncDispose ] ( )
11+ }
12+
813describe ( 'epic-web/prefer-dispose-in-tests' , ( ) => {
914 it ( 'reports lifecycle hooks that can move into a test body' , async ( ) => {
1015 const fixture = await writeOxlintFixture ( {
@@ -24,7 +29,6 @@ describe('epic-web/prefer-dispose-in-tests', () => {
2429 'epic-web/prefer-dispose-in-tests' : 'warn' ,
2530 } ,
2631 } )
27-
2832 try {
2933 const result = await runOxlint ( fixture )
3034 expect ( result . diagnostics ) . toHaveLength ( 1 )
@@ -34,7 +38,7 @@ describe('epic-web/prefer-dispose-in-tests', () => {
3438 } )
3539 expect ( result . diagnostics [ 0 ] . message ) . toContain ( 'instead of beforeEach' )
3640 } finally {
37- await fixture . cleanup ( )
41+ await cleanupFixture ( fixture )
3842 }
3943 } )
4044
@@ -68,12 +72,11 @@ describe('epic-web/prefer-dispose-in-tests', () => {
6872 'epic-web/prefer-dispose-in-tests' : 'warn' ,
6973 } ,
7074 } )
71-
7275 try {
7376 const result = await runOxlint ( fixture )
7477 expect ( result . diagnostics ) . toHaveLength ( 0 )
7578 } finally {
76- await fixture . cleanup ( )
79+ await cleanupFixture ( fixture )
7780 }
7881 } )
7982
@@ -98,13 +101,12 @@ describe('epic-web/prefer-dispose-in-tests', () => {
98101 ] ,
99102 } ,
100103 } )
101-
102104 try {
103105 const result = await runOxlint ( fixture )
104106 expect ( result . diagnostics ) . toHaveLength ( 1 )
105107 expect ( result . diagnostics [ 0 ] . message ) . toContain ( 'instead of beforeEach' )
106108 } finally {
107- await fixture . cleanup ( )
109+ await cleanupFixture ( fixture )
108110 }
109111 } )
110112} )
0 commit comments