@@ -10,6 +10,7 @@ const tap = require('tap')
1010const instrumentation = require ( '../../../../lib/instrumentation/koa/router-instrumentation' )
1111const { METHODS } = require ( '../../../../lib/instrumentation/http-methods' )
1212const helper = require ( '../../../lib/agent_helper' )
13+ const { removeModules } = require ( '../../../lib/cache-buster' )
1314const InstrumentationDescriptor = require ( '../../../../lib/instrumentation-descriptor' )
1415const WRAPPED_METHODS = [ 'param' , 'register' , 'routes' , 'middleware' , 'allowedMethods' ]
1516const UNWRAPPED_METHODS = METHODS . concat ( [
@@ -45,11 +46,7 @@ tap.test('koa-router', (t) => {
4546
4647 t . afterEach ( ( t ) => {
4748 helper . unloadAgent ( t . context . agent )
48- Object . keys ( require . cache ) . forEach ( ( key ) => {
49- if ( key . includes ( koaRouterMod ) ) {
50- delete require . cache [ key ]
51- }
52- } )
49+ removeModules ( [ koaRouterMod ] )
5350 } )
5451
5552 t . test ( 'mounting paramware' , async ( t ) => {
@@ -99,11 +96,7 @@ tap.test('koa-router', (t) => {
9996
10097 t . afterEach ( ( t ) => {
10198 helper . unloadAgent ( t . context . agent )
102- Object . keys ( require . cache ) . forEach ( ( key ) => {
103- if ( key . includes ( koaRouterMod ) ) {
104- delete require . cache [ key ]
105- }
106- } )
99+ removeModules ( [ koaRouterMod ] )
107100 } )
108101
109102 t . test ( 'mounting paramware' , async ( t ) => {
0 commit comments