From 25ba9943254c0511979eb0c75ce3a49d76d0b10c Mon Sep 17 00:00:00 2001 From: Corbin Crutchley Date: Sat, 8 Jan 2022 15:00:23 -0800 Subject: [PATCH] chore: fix tests --- __mocks__/modules/index.ts | 1 + __mocks__/modules/next-image.tsx | 9 +++++++++ jest.config.js | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 __mocks__/modules/next-image.tsx diff --git a/__mocks__/modules/index.ts b/__mocks__/modules/index.ts index 46054b7f..fa3eecfa 100644 --- a/__mocks__/modules/index.ts +++ b/__mocks__/modules/index.ts @@ -1,2 +1,3 @@ import "./disqus-react"; import "./next-link"; +import "./next-image"; diff --git a/__mocks__/modules/next-image.tsx b/__mocks__/modules/next-image.tsx new file mode 100644 index 00000000..fc96bb9c --- /dev/null +++ b/__mocks__/modules/next-image.tsx @@ -0,0 +1,9 @@ +jest.mock("next/image", () => { + const React = require("react"); + + return function NextImage(props: any) { + return {props.children}; + }; +}); + +export default {}; diff --git a/jest.config.js b/jest.config.js index b42e22c3..401ed828 100644 --- a/jest.config.js +++ b/jest.config.js @@ -26,7 +26,7 @@ module.exports = { }, transformIgnorePatterns: [ // ...your ignore patterns - "^((?!node_modules).)*node_modules.((?!unified|unist|hast|remark|mdast|micromark|retext|nlcst|rehype|decode\\-named\\-character\\-reference|character\\-entities|zwitch|longest\\-streak|unherit|parse\\-|strip\\-|html\\-void\\-elements|stringify\\-entities|ccount|markdown\\-|slash).)*$", + "^((?!node_modules).)*node_modules.((?!unified|unist|hast|remark|mdast|micromark|retext|nlcst|rehype|decode-named-character-reference|character-entities|zwitch|longest-streak|unherit|parse-|strip-|html-void-elements|stringify-entities|ccount|markdown-|slash|vfile|property-|space-separated-|comma-separated-|web-namespaces).)*$", "^.+\\.module\\.(css|sass|scss)$", ], // moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths),