mbolotov / intellij-cypress

IntelliJ-Cypress plugin: https://plugins.jetbrains.com/plugin/13819-intellij-cypress Pro version: https://plugins.jetbrains.com/plugin/13987-cypress-support-pro
MIT License
35 stars 5 forks source link

Unable to run non cypress tests via gutter. #56

Closed LucasCoderT closed 2 years ago

LucasCoderT commented 2 years ago

After installing the cypress pro plugin I am able to run my cypress tests via the gutter icon but all my non cypress tests that use Jest can no longer be ran

image

and I'm unsure why this is happening.

I name my unit tests with X.test.y and my cypress tests as X.spec.y

mbolotov commented 2 years ago

Hi Lucas! Could you somehow to share a project to reproduce the issue? If this is not possible, could you describe your test folder structure?

The plugin restrict creating a test other then Cypress via a gutter inside Cypress integration folder only. Is it your case? Just double checked: I'm able create a run config for a jest test via gutter in any other folder.

LucasCoderT commented 2 years ago

Hi, I'm currently testing it with this repo: https://github.com/codertheory/shiritori

I do get an error whenever I open my cypress test file:


ExternalToolPass: 

com.intellij.diagnostic.PluginException: annotator: me.mbolotov.cypress.lang.CyVariableRefAnnotator@535f96db (class me.mbolotov.cypress.lang.CyVariableRefAnnotator) [Plugin: me.mbolotov.cypress.pro]
    at com.intellij.ide.plugins.PluginManagerCore.createPluginException(PluginManagerCore.java:274)
    at com.intellij.diagnostic.PluginProblemReporterImpl.createPluginExceptionByClass(PluginProblemReporterImpl.java:12)
    at com.intellij.diagnostic.PluginException.createByClass(PluginException.java:91)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.process(ExternalToolPass.java:256)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doApply(ExternalToolPass.java:220)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.lambda$run$1(ExternalToolPass.java:184)
    at com.intellij.openapi.application.ReadAction.lambda$run$1(ReadAction.java:52)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:854)
    at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:61)
    at com.intellij.openapi.application.ReadAction.run(ReadAction.java:51)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.lambda$run$2(ExternalToolPass.java:181)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:183)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:705)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:647)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:63)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:170)
    at com.intellij.openapi.progress.util.BackgroundTaskUtil.runUnderDisposeAwareIndicator(BackgroundTaskUtil.java:270)
    at com.intellij.openapi.progress.util.BackgroundTaskUtil.runUnderDisposeAwareIndicator(BackgroundTaskUtil.java:248)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.run(ExternalToolPass.java:179)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:333)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:323)
    at com.intellij.util.ui.update.MergingUpdateQueue.lambda$flush$1(MergingUpdateQueue.java:273)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:287)
    at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:242)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:240)
    at com.intellij.util.Alarm$Request.runSafely(Alarm.java:391)
    at com.intellij.util.Alarm$Request.run(Alarm.java:377)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:220)
    at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:216)
    at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:27)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:195)
    at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:213)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:184)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: com.intellij.diagnostic.PluginException: Cannot load class me.mbolotov.cypress.lang.AliasReferenceResolve (
  error: com/intellij/model/SymbolReference,
  classLoader=PluginClassLoader(plugin=PluginDescriptor(name=Cypress Support Pro, id=me.mbolotov.cypress.pro, descriptorPath=plugin.xml, path=~/Library/Application Support/JetBrains/Toolbox/apps/WebStorm/ch-0/212.4746.80/WebStorm.app.plugins/Cypress Support Pro, version=2.3.0, package=null), packagePrefix=null, instanceId=79, state=active)
)
    at com.intellij.ide.plugins.cl.PluginClassLoader.loadClassInsideSelf(PluginClassLoader.java:441)
    at com.intellij.ide.plugins.cl.PluginClassLoader.tryLoadingClass(PluginClassLoader.java:275)
    at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:251)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    at me.mbolotov.cypress.lang.AliasReferenceMixin.getReference(Unknown Source)
    at me.mbolotov.cypress.lang.CyVariableRefAnnotator.apply(Unknown Source)
    at me.mbolotov.cypress.lang.CyVariableRefAnnotator.apply(Unknown Source)
    at com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl.applyExternalAnnotatorWithContext(AnnotationHolderImpl.java:203)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.doApply(ExternalToolPass.java:217)
    ... 37 more
Caused by: java.lang.NoClassDefFoundError: com/intellij/model/SymbolReference
    at java.base/java.lang.ClassLoader.defineClass2(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1109)
    at com.intellij.util.lang.UrlClassLoader.consumeClassData(UrlClassLoader.java:290)
    at com.intellij.util.lang.ZipResourceFile.findClass(ZipResourceFile.java:121)
    at com.intellij.util.lang.JarLoader.findClass(JarLoader.java:55)
    at com.intellij.util.lang.ClassPath.findClassInLoader(ClassPath.java:217)
    at com.intellij.util.lang.ClassPath.findClass(ClassPath.java:176)
    at com.intellij.ide.plugins.cl.PluginClassLoader.loadClassInsideSelf(PluginClassLoader.java:433)
    ... 45 more
Caused by: java.lang.ClassNotFoundException: com.intellij.model.SymbolReference PluginClassLoader(plugin=PluginDescriptor(name=Cypress Support Pro, id=me.mbolotov.cypress.pro, descriptorPath=plugin.xml, path=~/Library/Application Support/JetBrains/Toolbox/apps/WebStorm/ch-0/212.4746.80/WebStorm.app.plugins/Cypress Support Pro, version=2.3.0, package=null), packagePrefix=null, instanceId=79, state=active)
    at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:254)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    ... 53 more

it doesn't let me report the error though.

I've tried this repo on 2 seperate devices and they both result in this issue. If I disable the plugin I can run all my other tests fine

image
mbolotov commented 2 years ago

what IDE version do you use? It looks like a compatibility issue.

LucasCoderT commented 2 years ago

This is WebStorm 2021.2 the latest.

mbolotov commented 2 years ago

Could you please try this bundle? Cypress Support Pro-2.3.0-2021.2.zip

LucasCoderT commented 2 years ago

I no longer get the error, but my other tests still show "Nothing Here"

mbolotov commented 2 years ago

Seems you can fix the problem by adding jest package to your project (currently, it has jest-junit only)

LucasCoderT commented 2 years ago

Nice! Thank you so much. Weird how that works.

mbolotov commented 2 years ago

Yep. As I found, the Jest test producer first analyzes direct test dependencies. And if it finds any (including cypress producer), it stops. If nothing found, it searches for indirect dependencies.