From 94c182773f56f8413383b98adb67b633d0011b87 Mon Sep 17 00:00:00 2001 From: Tom Brunet Date: Thu, 6 Jul 2023 15:36:26 -0500 Subject: [PATCH] fix(node|karma|cypress): Fix axios usage in older node versions (#1533) * Fix axios usage in older node versions * Test with Node 14 --- .github/workflows/test.yml | 2 +- accessibility-checker/src/package.json | 2 +- common/module/src/api-ext/Fetch.ts | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d38d69e54..11f762969 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -142,7 +142,7 @@ jobs: strategy: matrix: - node-version: [18.x] + node-version: [14.x, 18.x] steps: - uses: actions/checkout@v3 diff --git a/accessibility-checker/src/package.json b/accessibility-checker/src/package.json index 4219ef30d..7d2802528 100644 --- a/accessibility-checker/src/package.json +++ b/accessibility-checker/src/package.json @@ -18,7 +18,7 @@ "author": "IBM Accessibility", "license": "Apache-2.0", "dependencies": { - "axios": "^0.27.2", + "axios": "^1.4.0", "chromedriver": "*", "deep-diff": "^1.0.2", "exceljs": "^4.3.0", diff --git a/common/module/src/api-ext/Fetch.ts b/common/module/src/api-ext/Fetch.ts index 37ed798a5..2a9f12ac9 100644 --- a/common/module/src/api-ext/Fetch.ts +++ b/common/module/src/api-ext/Fetch.ts @@ -22,9 +22,10 @@ export async function fetch_get(url: string) { return await resp.json(); } else { if (!axios) { - axios = import("axios"); + axios = await import("axios"); } const response = await axios.get(url); - return JSON.parse(await response.data); + const data = await response.data; + return data; } } \ No newline at end of file