Skip to content

Commit

Permalink
Merge pull request #870 from frontity/pin-node-fetch-version
Browse files Browse the repository at this point in the history
Pin node-fetch version temporarily
  • Loading branch information
luisherranz committed Sep 22, 2021
2 parents ab39dbc + d05c1da commit e3f947e
Show file tree
Hide file tree
Showing 10 changed files with 4,128 additions and 4,108 deletions.
6 changes: 6 additions & 0 deletions .changeset/wild-suns-worry.md
@@ -0,0 +1,6 @@
---
"frontity": patch
"@frontity/wp-source": patch
---

Pin `node-fetch` version until they solve [the import problem](https://github.com/node-fetch/node-fetch/pull/1303) introduced in v2.6.3. Thanks to @robrecord for the catch.
14 changes: 7 additions & 7 deletions e2e/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion e2e/package.json
Expand Up @@ -35,7 +35,7 @@
"http-server": "^0.12.3",
"minimist": "^1.2.5",
"node-env-run": "^4.0.2",
"node-fetch": "^2.6.1",
"node-fetch": "2.6.2",
"selenium-side-runner": "^3.17.0",
"wait-on": "^5.2.1",
"wdio-chromedriver-service": "^7.0.0"
Expand Down
8,200 changes: 4,103 additions & 4,097 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions packages/components/__tests__/image.jsdom.tests.tsx
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable @typescript-eslint/no-empty-function */
/* eslint-disable no-global-assign */

Expand All @@ -15,6 +16,7 @@ jest.mock("@frontity/hooks/use-in-view", () => ({

// Mock only useConnect in the 'frontity' module
jest.mock("frontity", () => ({
// @ts-ignore
...jest.requireActual("frontity"),
useConnect: () => ({
state: {
Expand Down
3 changes: 3 additions & 0 deletions packages/components/__tests__/image.node.tests.tsx
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */

/**
* @jest-environment node
*/
Expand All @@ -7,6 +9,7 @@ import Image from "../image";

// Mock only useConnect in the 'frontity' module
jest.mock("frontity", () => ({
// @ts-ignore
...jest.requireActual("frontity"),
useConnect: () => ({
state: {
Expand Down
3 changes: 3 additions & 0 deletions packages/components/link/__tests__/link.tests.tsx
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { render, unmountComponentAtNode } from "react-dom";
import { act } from "react-dom/test-utils";
import { create } from "react-test-renderer";
Expand Down Expand Up @@ -547,6 +548,7 @@ describe("Link prefetching", () => {
get.mockReturnValue({ isReady: false, isFetching: false });
jest.spyOn(store.actions.source, "fetch");
// simulate save data mode
// @ts-ignore
(navigator as Navigator & { connection }).connection = { saveData: true };
act(() => {
render(
Expand All @@ -562,6 +564,7 @@ describe("Link prefetching", () => {
expect(store.actions.source.fetch).toHaveBeenCalledTimes(0);
expect(store.actions.source.fetch).not.toHaveBeenCalledWith(linkUrl1);

// @ts-ignore
(navigator as Navigator & { connection }).connection = { saveData: false };
});

Expand Down
2 changes: 1 addition & 1 deletion packages/components/link/utils.ts
Expand Up @@ -184,7 +184,7 @@ export const shouldFetchLink = (link: string) => {
/**
* Checks if user is on slow connection or has enabled data saver.
*/
const _navigator = window.navigator as NavigatorWithConnection;
const _navigator = window.navigator as unknown as NavigatorWithConnection;

const isSlowConnection =
_navigator?.connection?.saveData ||
Expand Down
2 changes: 1 addition & 1 deletion packages/frontity/package.json
Expand Up @@ -58,7 +58,7 @@
"inquirer": "^7.3.3",
"is-root": "^2.1.0",
"leven": "^3.1.0",
"node-fetch": "^2.6.1",
"node-fetch": "2.6.2",
"ora": "^5.1.0",
"ramda": "^0.27.1",
"react-helmet-async": "^1.0.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/wp-source/package.json
Expand Up @@ -30,6 +30,6 @@
"devDependencies": {
"@frontity/connect": "^1.3.0",
"clone-deep": "^4.0.1",
"node-fetch": "^2.6.1"
"node-fetch": "2.6.2"
}
}

0 comments on commit e3f947e

Please sign in to comment.