Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: Quill is not defined #4460

Open
RichMatthews opened this issue Oct 24, 2024 · 0 comments
Open

ReferenceError: Quill is not defined #4460

RichMatthews opened this issue Oct 24, 2024 · 0 comments

Comments

@RichMatthews
Copy link

RichMatthews commented Oct 24, 2024

Please describe the a concise description and fill out the details below. It will help others efficiently understand your request and get to an answer instead of repeated back and forth. Providing a minimal, complete and verifiable example will further increase your chances that someone can help.

Steps for Reproduction

I am trying to test my Quill editor with jest

import Quill from "quill"
import "quill-mention/autoregister"

This throws Cannot find module 'quill-mention/autoregister' from 'src/components/QuillEditor/QuillEditor.tsx'

so in jest.config.ts I added

  moduleNameMapper: {
    "^quill-mention/autoregister":
      "<rootDir>/node_modules/quill-mention/dist/quill.mention.js",
    "^quill$": "<rootDir>/node_modules/quill/dist/quill.js",
  },

but now this gives: ReferenceError: Quill is not defined which I don't understand because I already mocked it?

I have also tried other ways by doing: import { Mention } from "quill-mention" and then trying to register it but this didn't get me any closer

Expected behavior:

  • Should be able to test the component

Actual behavior:

  • Unable to test my component

Version:

versions being used:

"quill": "^2.0.2",
"quill-mention": "^6.0.1",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant