-
-
Notifications
You must be signed in to change notification settings - Fork 135
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
Error testing with Vitest #506
Comments
Is this a problem with Vite then? |
@somecho I have no problem writing test cases with |
Tried the project with react-codemirror version |
I've got this issue too. |
We are experiencing the same issue (Vitest+react-codemirror) from the moment we introduced the following code (relevant parts):
This error only appears in tests and not in dev/production |
We're likely going to use jest. |
@somecho fyi I managed to resolve the error in your reproduction repo with the following changes: -import { clojure } from '@nextjournal/lang-clojure'
+import { langs } from '@uiw/codemirror-extensions-langs';
function App() {
return (
<>
<div>Bug Reproduction</div>
<CodeMirror
value={'(+ 1 1)'}
- extensions={[clojure()]}
+ extensions={[langs.clojure()]} It's still using
|
Any updates about this? I'm facing the same issue :/ |
Basically, you need to force the CJS version of @codemirror/state and all other packages depending on it. |
This is part of the Keyword Search GA project (see background below). The core change is that we use the default pattern type consistently for the query input field and preview. Before, we hardcoded `literal` as the default and used `standard` for previews. This is does not affect existing code monitors. Other fixes: - highlight keyword queries correctly Background: - "keyword" will soon be the new default pattern type - the default pattern type can be overridden in the user/global settings - query fields in all of our products should respect the default Test Plan: - The unit test is currently "skipped" with the following comment ``` // TODO: these tests trigger an error with CodeMirror, complaining about being // loaded twice, see uiwjs/react-codemirror#506 ``` - Manual testing: - I created several code monitors with and without pattern type and checked in the DB that the correct pattern type was appended. - I configured a new default pattern type in my user settings and verified that the setting changes the default pattern type for code monitors. Co-authored-by: Felix Kling <[email protected]>
This is part of the Keyword Search GA project (see background below). The core change is that we use the default pattern type consistently for the query input field and preview. Before, we hardcoded `literal` as the default and used `standard` for previews. This is does not affect existing code monitors. Other fixes: - highlight keyword queries correctly Background: - "keyword" will soon be the new default pattern type - the default pattern type can be overridden in the user/global settings - query fields in all of our products should respect the default Test Plan: - The unit test is currently "skipped" with the following comment ``` // TODO: these tests trigger an error with CodeMirror, complaining about being // loaded twice, see uiwjs/react-codemirror#506 ``` - Manual testing: - I created several code monitors with and without pattern type and checked in the DB that the correct pattern type was appended. - I configured a new default pattern type in my user settings and verified that the setting changes the default pattern type for code monitors. Co-authored-by: Felix Kling <[email protected]>
I get the following error when I test a component with codemirror:
Here is a minimal project reproducing this error: https://github.com/somecho/react-codemirror-vitest
Someone else is also facing this issue.
The text was updated successfully, but these errors were encountered: