From 6c7ebab3674fbf8a21275cfe9e06f71740219c05 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Tue, 20 Sep 2022 10:43:02 +0700 Subject: [PATCH] Minor tweaks for ESM strict mode --- benchmark/index.ts | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/benchmark/index.ts b/benchmark/index.ts index 5c0a58e90..9f8a530da 100644 --- a/benchmark/index.ts +++ b/benchmark/index.ts @@ -1,6 +1,6 @@ import {URL} from 'node:url'; import https from 'node:https'; -import axios from 'axios'; +/// import axios from 'axios'; import Benchmark from 'benchmark'; import fetch from 'node-fetch'; import request from 'request'; @@ -41,18 +41,18 @@ const fetchOptions = { agent: httpsAgent, }; -const axiosOptions = { - url: urlString, - httpsAgent, - https: { - rejectUnauthorized: false, - }, -}; +/// const axiosOptions = { +// url: urlString, +// httpsAgent, +// https: { +// rejectUnauthorized: false, +// }, +// }; -const axiosStreamOptions: typeof axiosOptions & {responseType: 'stream'} = { - ...axiosOptions, - responseType: 'stream', -}; +// const axiosStreamOptions: typeof axiosOptions & {responseType: 'stream'} = { +// ...axiosOptions, +// responseType: 'stream', +// }; const httpsOptions = { https: { @@ -136,19 +136,23 @@ suite.add('got - promise', { }).add('axios - promise', { defer: true, async fn(deferred: {resolve: () => void}) { - await axios.request(axiosOptions); + // Disabled until it has correct types. + // await axios.request(axiosOptions); deferred.resolve(); }, }).add('axios - stream', { defer: true, async fn(deferred: {resolve: () => void}) { - const result = await axios.request(axiosStreamOptions); - const {data}: any = result; + // Disabled until it has correct types. + // const result = await axios.request(axiosStreamOptions); + // const {data}: any = result; - data.resume(); - data.once('end', () => { - deferred.resolve(); - }); + // data.resume(); + // data.once('end', () => { + // deferred.resolve(); + // }); + + deferred.resolve(); }, }).add('https - stream', { defer: true,