udecode / plate

The rich-text editor for React.
https://platejs.org
Other
9.75k stars 624 forks source link

Running a jest test generates `Cannot find module '@udecode/plate-core/server'` error #3217

Open TrySpace opened 3 months ago

TrySpace commented 3 months ago

Description

When running a jest test which includes imports from @udecode/plate-common generates the error Cannot find module '@udecode/plate-core/server'

Cannot find module '@udecode/plate-core/server' from 'node_modules/@udecode/plate-utils/dist/index.js'

Steps to Reproduce

Jest doesn't clearly say which import it is but it's one of the imports from the shared MyPlateEditor.types file:

import {
  EDescendant,
  EElement,
  EElementEntry,
  EElementOrText,
  EMarks,
  ENode,
  ENodeEntry,
  EText,
  ETextEntry,
  TElement,
  TNodeEntry,
  TReactEditor,
  createTEditor,
  getTEditor,
} from '@udecode/plate-common'

plate fial

Environment

ns-harshp commented 3 months ago

Hey @TrySpace, Did you find any solution around it? I'm facing same issue.

TrySpace commented 3 months ago

No, I've disabled the test for now 🤷🏻

reactima commented 2 months ago

Please kindly fix this issue.

This might related to misconfigured imports in

src/packages/slate-plate/common/src/server.ts src/packages/slate-plate/common/src/index.tsx

I have a wild tsconfig and cach deps and see messages like this

TS2305: Module "@udecode/plate-core/server" has no exported member applyDeepToNodes

ECecillo commented 1 month ago

We upgraded Jest from version 27.2 to the latest stable version (29.7) and it fixed the issue above.