11'use strict' ;
22
3+ const process = require ( 'node:process' ) ;
34const path = require ( 'path' ) ;
45const fs = require ( 'fs' ) ;
56const test = require ( 'supertape' ) ;
6- const fetch = require ( 'node-fetch' ) ;
77
88const connectPath = '../lib/connect' ;
99const connect = require ( connectPath ) ;
@@ -13,6 +13,7 @@ const getName = (dist) => path.join(__dirname, '../../', dist, 'fileop.js');
1313
1414test ( 'fileop: static' , async ( t ) => {
1515 const { url, done} = await connect ( ) ;
16+ const { default : fetch } = await import ( 'node-fetch' ) ;
1617 const res = await fetch ( `${ url } /fileop.js` ) ;
1718 const text = await res . text ( ) ;
1819 const name = getName ( 'dist' ) ;
@@ -34,6 +35,7 @@ test('fileop: static: dev', async (t) => {
3435 const connect = require ( connectPath ) ;
3536
3637 const { url, done} = await connect ( ) ;
38+ const { default : fetch } = await import ( 'node-fetch' ) ;
3739 const res = await fetch ( `${ url } /fileop.js` ) ;
3840 const text = await res . text ( ) ;
3941 const name = getName ( 'dist-dev' ) ;
@@ -50,6 +52,7 @@ test('fileop: static: dev', async (t) => {
5052
5153test ( 'fileop: static: 404' , async ( t ) => {
5254 const { url, done} = await connect ( ) ;
55+ const { default : fetch } = await import ( 'node-fetch' ) ;
5356 const { status} = await fetch ( `${ url } /hello.txt` ) ;
5457
5558 done ( ) ;
0 commit comments