11import assert from 'node:assert/strict' ;
2- import { describe , it , mock } from 'node:test' ;
2+ import { describe , it , mock , afterEach } from 'node:test' ;
33
44import {
55 groupNodesByModule ,
@@ -144,6 +144,8 @@ describe('buildApiDocURL', () => {
144144} ) ;
145145
146146describe ( 'createLazyGenerator' , ( ) => {
147+ afterEach ( ( ) => mock . restoreAll ( ) ) ;
148+
147149 it ( 'spreads metadata properties onto the returned object' , ( ) => {
148150 const metadata = { name : 'ast' , version : '1.0.0' , dependsOn : undefined } ;
149151 const gen = createLazyGenerator ( metadata ) ;
@@ -163,7 +165,6 @@ describe('createLazyGenerator', () => {
163165 const gen = createLazyGenerator ( { name : 'ast' } ) ;
164166 const result = await gen . generate ( 'hello' ) ;
165167 assert . equal ( result , 'processed:hello' ) ;
166- mock . restoreAll ( ) ;
167168 } ) ;
168169
169170 it ( 'exposes a processChunk function that delegates to the lazily loaded module' , async ( ) => {
@@ -177,6 +178,5 @@ describe('createLazyGenerator', () => {
177178 const gen = createLazyGenerator ( { name : 'ast' } ) ;
178179 const result = await gen . processChunk ( [ 'a' , 'b' , 'c' ] , [ 0 , 2 ] ) ;
179180 assert . deepStrictEqual ( result , [ 'a' , 'c' ] ) ;
180- mock . restoreAll ( ) ;
181181 } ) ;
182182} ) ;
0 commit comments