From a55bf048d74484703a52ba2c28070bdb7c6a7304 Mon Sep 17 00:00:00 2001 From: Stanislaw Wilczynski Date: Tue, 8 Oct 2024 17:17:12 +0200 Subject: [PATCH 1/2] bring back default import for invariant --- .../nova-centralized-commanding-provider.tsx | 2 +- .../src/eventing/nova-eventing-provider.tsx | 2 +- packages/nova-react/src/graphql/hooks.ts | 2 +- .../nova-react/src/graphql/nova-graphql-provider.tsx | 2 +- scripts/config/jest.config.ts | 12 +++++++++++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/nova-react/src/commanding/nova-centralized-commanding-provider.tsx b/packages/nova-react/src/commanding/nova-centralized-commanding-provider.tsx index 82c5ad7..09a06f3 100644 --- a/packages/nova-react/src/commanding/nova-centralized-commanding-provider.tsx +++ b/packages/nova-react/src/commanding/nova-centralized-commanding-provider.tsx @@ -1,6 +1,6 @@ import * as React from "react"; import type { NovaCentralizedCommanding } from "@nova/types"; -import * as invariant from "invariant"; +import invariant from "invariant"; // Initializing default with null to make sure providers are correctly placed in the tree const NovaCommandingContext = diff --git a/packages/nova-react/src/eventing/nova-eventing-provider.tsx b/packages/nova-react/src/eventing/nova-eventing-provider.tsx index bfc5677..da3b941 100644 --- a/packages/nova-react/src/eventing/nova-eventing-provider.tsx +++ b/packages/nova-react/src/eventing/nova-eventing-provider.tsx @@ -1,7 +1,7 @@ import * as React from "react"; import type { NovaEvent, NovaEventing, EventWrapper } from "@nova/types"; import { InputType } from "@nova/types"; -import * as invariant from "invariant"; +import invariant from "invariant"; // Context is initialized with an empty object and this is null-checked within the hooks const NovaEventingContext = React.createContext({}); diff --git a/packages/nova-react/src/graphql/hooks.ts b/packages/nova-react/src/graphql/hooks.ts index 14d16c4..1010ad1 100644 --- a/packages/nova-react/src/graphql/hooks.ts +++ b/packages/nova-react/src/graphql/hooks.ts @@ -1,5 +1,5 @@ import { useNovaGraphQL } from "./nova-graphql-provider"; -import * as invariant from "invariant"; +import invariant from "invariant"; import type { GraphQLTaggedNode } from "./taggedNode"; import type { diff --git a/packages/nova-react/src/graphql/nova-graphql-provider.tsx b/packages/nova-react/src/graphql/nova-graphql-provider.tsx index 0ea9184..1009f02 100644 --- a/packages/nova-react/src/graphql/nova-graphql-provider.tsx +++ b/packages/nova-react/src/graphql/nova-graphql-provider.tsx @@ -1,6 +1,6 @@ import * as React from "react"; import type { NovaGraphQL } from "@nova/types"; -import * as invariant from "invariant"; +import invariant from "invariant"; // Initializing default with null to make sure providers are correctly placed in the tree const NovaGraphQLContext = React.createContext(null); diff --git a/scripts/config/jest.config.ts b/scripts/config/jest.config.ts index aea7740..59ddd4f 100644 --- a/scripts/config/jest.config.ts +++ b/scripts/config/jest.config.ts @@ -1,10 +1,20 @@ import * as path from "path"; +import type { JestConfigWithTsJest } from "ts-jest"; -export default { +const config: JestConfigWithTsJest = { preset: "ts-jest", rootDir: process.cwd(), roots: ["/src"], testPathIgnorePatterns: ["node_modules", "__generated__"], testEnvironment: "jsdom", setupFiles: [path.join(__dirname, "jest.setup.ts")], + globals: { + "ts-jest": { + tsconfig: { + esModuleInterop: true, + }, + }, + }, }; + +export default config; From dd1e8ca26e651fe6cd84bf91e05e46b98a455319 Mon Sep 17 00:00:00 2001 From: Stanislaw Wilczynski Date: Tue, 8 Oct 2024 17:17:46 +0200 Subject: [PATCH 2/2] Change files --- .../@nova-react-7777c2ef-6eb5-4013-bbf2-3d51bb071261.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/@nova-react-7777c2ef-6eb5-4013-bbf2-3d51bb071261.json diff --git a/change/@nova-react-7777c2ef-6eb5-4013-bbf2-3d51bb071261.json b/change/@nova-react-7777c2ef-6eb5-4013-bbf2-3d51bb071261.json new file mode 100644 index 0000000..6dd411a --- /dev/null +++ b/change/@nova-react-7777c2ef-6eb5-4013-bbf2-3d51bb071261.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "bring back default import for invariant", + "packageName": "@nova/react", + "email": "Stanislaw.Wilczynski@microsoft.com", + "dependentChangeType": "patch" +}