diff --git a/package.json b/package.json index 5b202bf196dbdf..668b386bcad42a 100644 --- a/package.json +++ b/package.json @@ -793,7 +793,7 @@ "antlr4ts": "^0.5.0-alpha.3", "archiver": "^5.3.1", "async": "^3.2.3", - "axios": "^0.27.2", + "axios": "^1.1.2", "base64-js": "^1.3.1", "bitmap-sdf": "^1.0.3", "blurhash": "^2.0.1", @@ -1549,5 +1549,10 @@ "xml-crypto": "^3.0.1", "xmlbuilder": "13.0.2", "yargs": "^15.4.1" + }, + "jest": { + "moduleNameMapper": { + "axios": "axios/dist/node/axios.cjs" + } } } \ No newline at end of file diff --git a/packages/kbn-ci-stats-reporter/src/ci_stats_reporter.ts b/packages/kbn-ci-stats-reporter/src/ci_stats_reporter.ts index 0f469de2a4ebe3..62da562ad14768 100644 --- a/packages/kbn-ci-stats-reporter/src/ci_stats_reporter.ts +++ b/packages/kbn-ci-stats-reporter/src/ci_stats_reporter.ts @@ -18,9 +18,6 @@ import { REPO_ROOT, kibanaPackageJson } from '@kbn/repo-info'; import { parseConfig, Config, CiStatsMetadata } from '@kbn/ci-stats-core'; import type { SomeDevLog } from '@kbn/some-dev-log'; -// @ts-expect-error not "public", but necessary to prevent Jest shimming from breaking things -import httpAdapter from 'axios/lib/adapters/http'; - import type { CiStatsTestGroupInfo, CiStatsTestRun } from './ci_stats_test_group_types'; const BASE_URL = 'https://ci-stats.kibana.dev'; @@ -375,7 +372,7 @@ export class CiStatsReporter { headers, data: body, params: query, - adapter: httpAdapter, + adapter: 'http', // if it can be serialized into a string, send it maxBodyLength: Infinity, diff --git a/src/dev/build/lib/download.ts b/src/dev/build/lib/download.ts index d39cb7d77f9610..d7f0b1dfe43b48 100644 --- a/src/dev/build/lib/download.ts +++ b/src/dev/build/lib/download.ts @@ -16,10 +16,6 @@ import Axios from 'axios'; import { isAxiosResponseError } from '@kbn/dev-utils'; import { ToolingLog } from '@kbn/tooling-log'; -// https://github.com/axios/axios/tree/ffea03453f77a8176c51554d5f6c3c6829294649/lib/adapters -// @ts-expect-error untyped internal module used to prevent axios from using xhr adapter in tests -import AxiosHttpAdapter from 'axios/lib/adapters/http'; - import { mkdirp } from './fs'; function tryUnlink(path: string) { @@ -78,7 +74,7 @@ export async function downloadToDisk({ const response = await Axios.request({ url, responseType: 'stream', - adapter: AxiosHttpAdapter, + adapter: 'http', }); if (response.status !== 200) { @@ -171,7 +167,7 @@ export async function downloadToString({ const resp = await Axios.request({ url, method: 'GET', - adapter: AxiosHttpAdapter, + adapter: 'http', responseType: 'text', validateStatus: !expectStatus ? undefined : (status) => status === expectStatus, }); diff --git a/yarn.lock b/yarn.lock index 3fa41c07ccd713..7800daba416728 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11048,14 +11048,6 @@ axios@^0.26.0: dependencies: follow-redirects "^1.14.8" -axios@^0.27.2: - version "0.27.2" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972" - integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ== - dependencies: - follow-redirects "^1.14.9" - form-data "^4.0.0" - axios@^1.1.2, axios@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/axios/-/axios-1.4.0.tgz#38a7bf1224cd308de271146038b551d725f0be1f" @@ -16322,7 +16314,7 @@ folktale@2.3.2: resolved "https://registry.yarnpkg.com/folktale/-/folktale-2.3.2.tgz#38231b039e5ef36989920cbf805bf6b227bf4fd4" integrity sha512-+8GbtQBwEqutP0v3uajDDoN64K2ehmHd0cjlghhxh0WpcfPzAIjPA03e1VvHlxL02FVGR0A6lwXsNQKn3H1RNQ== -follow-redirects@^1.0.0, follow-redirects@^1.14.0, follow-redirects@^1.14.8, follow-redirects@^1.14.9, follow-redirects@^1.15.0: +follow-redirects@^1.0.0, follow-redirects@^1.14.0, follow-redirects@^1.14.8, follow-redirects@^1.15.0: version "1.15.2" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==