From 12caf46c6d43a04ce172033ef423f184b53cc3d3 Mon Sep 17 00:00:00 2001 From: Ophelia Goldstein <159258143+opheliagoldstein@users.noreply.github.com> Date: Wed, 8 Oct 2025 01:42:04 +0300 Subject: [PATCH] fix: remove duplicate jest globals imports inside tests files (#4541) Co-authored-by: Alexandr --- tests/api.test.js | 10 ++++++++-- tests/gist.test.js | 3 +-- tests/pat-info.test.js | 10 ++++++++-- tests/pin.test.js | 3 +-- tests/retryer.test.js | 3 +-- tests/status.up.test.js | 4 ++-- tests/top-langs.test.js | 3 +-- tests/wakatime.test.js | 3 +-- 8 files changed, 23 insertions(+), 16 deletions(-) diff --git a/tests/api.test.js b/tests/api.test.js index bd255455..b20fa698 100644 --- a/tests/api.test.js +++ b/tests/api.test.js @@ -1,13 +1,19 @@ // @ts-check -import { beforeEach, jest } from "@jest/globals"; import axios from "axios"; import MockAdapter from "axios-mock-adapter"; import api from "../api/index.js"; import { calculateRank } from "../src/calculateRank.js"; import { renderStatsCard } from "../src/cards/stats.js"; import { CONSTANTS, renderError } from "../src/common/utils.js"; -import { expect, it, describe, afterEach } from "@jest/globals"; +import { + expect, + it, + describe, + afterEach, + beforeEach, + jest, +} from "@jest/globals"; /** * @type {import("../src/fetchers/stats").StatsData} diff --git a/tests/gist.test.js b/tests/gist.test.js index bfe5d774..98670adc 100644 --- a/tests/gist.test.js +++ b/tests/gist.test.js @@ -1,10 +1,9 @@ // @ts-check -import { jest } from "@jest/globals"; import "@testing-library/jest-dom"; import axios from "axios"; import MockAdapter from "axios-mock-adapter"; -import { expect, it, describe, afterEach } from "@jest/globals"; +import { expect, it, describe, afterEach, jest } from "@jest/globals"; import { renderGistCard } from "../src/cards/gist.js"; import { CONSTANTS, renderError } from "../src/common/utils.js"; import gist from "../api/gist.js"; diff --git a/tests/pat-info.test.js b/tests/pat-info.test.js index 6c71d401..0f8783df 100644 --- a/tests/pat-info.test.js +++ b/tests/pat-info.test.js @@ -4,11 +4,17 @@ import dotenv from "dotenv"; dotenv.config(); -import { jest } from "@jest/globals"; import axios from "axios"; import MockAdapter from "axios-mock-adapter"; import patInfo, { RATE_LIMIT_SECONDS } from "../api/status/pat-info.js"; -import { expect, it, describe, afterEach, beforeAll } from "@jest/globals"; +import { + expect, + it, + describe, + afterEach, + beforeAll, + jest, +} from "@jest/globals"; const mock = new MockAdapter(axios); diff --git a/tests/pin.test.js b/tests/pin.test.js index 88e43165..34212649 100644 --- a/tests/pin.test.js +++ b/tests/pin.test.js @@ -1,13 +1,12 @@ // @ts-check -import { jest } from "@jest/globals"; import "@testing-library/jest-dom"; import axios from "axios"; import MockAdapter from "axios-mock-adapter"; import pin from "../api/pin.js"; import { renderRepoCard } from "../src/cards/repo.js"; import { CONSTANTS, renderError } from "../src/common/utils.js"; -import { expect, it, describe, afterEach } from "@jest/globals"; +import { expect, it, describe, afterEach, jest } from "@jest/globals"; const data_repo = { repository: { diff --git a/tests/retryer.test.js b/tests/retryer.test.js index 76630039..e231a366 100644 --- a/tests/retryer.test.js +++ b/tests/retryer.test.js @@ -1,8 +1,7 @@ -import { jest } from "@jest/globals"; import "@testing-library/jest-dom"; import { retryer, RETRIES } from "../src/common/retryer.js"; import { logger } from "../src/common/utils.js"; -import { expect, it, describe } from "@jest/globals"; +import { expect, it, describe, jest } from "@jest/globals"; const fetcher = jest.fn((variables, token) => { logger.log(variables, token); diff --git a/tests/status.up.test.js b/tests/status.up.test.js index f15b96fb..f7c08692 100644 --- a/tests/status.up.test.js +++ b/tests/status.up.test.js @@ -1,11 +1,11 @@ /** * @file Tests for the status/up cloud function. */ -import { jest } from "@jest/globals"; + import axios from "axios"; import MockAdapter from "axios-mock-adapter"; import up, { RATE_LIMIT_SECONDS } from "../api/status/up.js"; -import { expect, it, describe, afterEach } from "@jest/globals"; +import { expect, it, describe, afterEach, jest } from "@jest/globals"; const mock = new MockAdapter(axios); diff --git a/tests/top-langs.test.js b/tests/top-langs.test.js index cdd47d72..1e48ccfd 100644 --- a/tests/top-langs.test.js +++ b/tests/top-langs.test.js @@ -1,13 +1,12 @@ // @ts-check -import { jest } from "@jest/globals"; import "@testing-library/jest-dom"; import axios from "axios"; import MockAdapter from "axios-mock-adapter"; import topLangs from "../api/top-langs.js"; import { renderTopLanguages } from "../src/cards/top-languages.js"; import { CONSTANTS, renderError } from "../src/common/utils.js"; -import { expect, it, describe, afterEach } from "@jest/globals"; +import { expect, it, describe, afterEach, jest } from "@jest/globals"; const data_langs = { data: { diff --git a/tests/wakatime.test.js b/tests/wakatime.test.js index ade0dc2b..8afdecf1 100644 --- a/tests/wakatime.test.js +++ b/tests/wakatime.test.js @@ -1,10 +1,9 @@ -import { jest } from "@jest/globals"; import "@testing-library/jest-dom"; import axios from "axios"; import MockAdapter from "axios-mock-adapter"; import wakatime from "../api/wakatime.js"; import { renderWakatimeCard } from "../src/cards/wakatime.js"; -import { expect, it, describe, afterEach } from "@jest/globals"; +import { expect, it, describe, afterEach, jest } from "@jest/globals"; const wakaTimeData = { data: {