File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
projects/testing-library/src/lib Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -352,10 +352,16 @@ function cleanupAtFixture(fixture) {
352352 mountedFixtures . delete ( fixture ) ;
353353}
354354
355- if ( typeof afterEach === 'function' && ! process . env . ATL_SKIP_AUTO_CLEANUP ) {
356- afterEach ( async ( ) => {
357- cleanup ( ) ;
358- } ) ;
355+ // if we're running in a test runner that supports afterEach
356+ // then we'll automatically run cleanup afterEach test
357+ // this ensures that tests run in isolation from each other
358+ // if you don't like this, set the ATL_SKIP_AUTO_CLEANUP env variable to 'true'
359+ if ( typeof process === 'undefined' || ! process . env ?. ATL_SKIP_AUTO_CLEANUP ) {
360+ if ( typeof afterEach === 'function' ) {
361+ afterEach ( ( ) => {
362+ cleanup ( ) ;
363+ } ) ;
364+ }
359365}
360366
361367// TODO: rename to `atl-wrapper-component`
You can’t perform that action at this time.
0 commit comments