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

Program run arguments escapes double quotes #52

Closed rhpkegel closed 3 years ago

rhpkegel commented 3 years ago

Our setup adds a run argument with -e TAGS="not @disabled-bugged OR @not-implemented". The double quotes in these are now incorrectly escaped, as the final command now includes -e TAGS=\"not @disabled-bugged OR @not-implemented\" causing the argument not to work. I believe this is a recent issue, this used to work fine. Is there a way to prevent these escape characters from being added?

mbolotov commented 3 years ago

Hi @rhpkegel! I don't remember changing something like this in recent versions. It seems there is no workaround currently. I will look into this problem later today.

mbolotov commented 3 years ago

@rhpkegel I think I've fixed the problem. Could you try this snapshot bundle?
Cypress Support Pro-2.3.0-SNAPSHOT.zip

rhpkegel commented 3 years ago

unfortunately the problem seems to persist. My program arguments: image The output command (some user specific things whited out): output2 and the currently running version: image

EDIT: I just noticed that it did throw a few exceptions, maybe the stacktrace is of use to you:

java.lang.NullPointerException: this.containingFile must not be null
    at me.mbolotov.cypress.findusages.FindusagesKt.getAliasHost(Unknown Source)
    at me.mbolotov.cypress.lang.CyAliasReferencesSearch.execute(Unknown Source)
    at me.mbolotov.cypress.lang.CyAliasReferencesSearch.execute(Unknown Source)
    at com.intellij.util.ExecutorsQuery.processResults(ExecutorsQuery.java:28)
    at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:91)
    at com.intellij.util.AbstractQuery.delegateProcessResults(AbstractQuery.java:108)
    at com.intellij.util.MergeQuery.processResults(MergeQuery.java:22)
    at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:91)
    at com.intellij.util.AbstractQuery.delegateProcessResults(AbstractQuery.java:108)
    at com.intellij.util.UniqueResultsQuery.processResults(UniqueResultsQuery.java:39)
    at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:91)
    at com.intellij.util.AbstractQuery.forEach(AbstractQuery.java:83)
    at com.intellij.util.AbstractQuery.findAll(AbstractQuery.java:28)
    at com.intellij.find.findUsages.FindUsagesHandlerBase.findReferencesToHighlight(FindUsagesHandlerBase.java:114)
    at com.intellij.find.findUsages.JavaFindUsagesHandler.findReferencesToHighlight(JavaFindUsagesHandler.java:264)
    at com.intellij.codeInsight.highlighting.HighlightUsagesKt.getPsiUsageRanges(highlightUsages.kt:85)
    at com.intellij.codeInsight.highlighting.HighlightUsagesKt.getUsageRanges(highlightUsages.kt:56)
    at com.intellij.codeInsight.daemon.impl.IdentifierHighlighterPass.lambda$highlightTargetUsages$0(IdentifierHighlighterPass.java:199)
    at com.intellij.util.AstLoadingFilter.lambda$toComputable$2(AstLoadingFilter.java:174)
    at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:132)
    at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:116)
    at com.intellij.codeInsight.daemon.impl.IdentifierHighlighterPass.highlightTargetUsages(IdentifierHighlighterPass.java:198)
    at com.intellij.codeInsight.daemon.impl.IdentifierHighlighterPass.highlightReferencesAndDeclarations(IdentifierHighlighterPass.java:174)
    at com.intellij.codeInsight.daemon.impl.IdentifierHighlighterPass.doCollectInformation(IdentifierHighlighterPass.java:92)
    at com.intellij.codeInsight.highlighting.BackgroundHighlighter.lambda$updateHighlighted$1(BackgroundHighlighter.java:147)
    at com.intellij.codeInsight.highlighting.BackgroundHighlightingUtil.lambda$lookForInjectedFileInOtherThread$0(BackgroundHighlightingUtil.java:55)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.insideReadAction(NonBlockingReadActionImpl.java:521)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$attemptComputation$3(NonBlockingReadActionImpl.java:468)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1096)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runInReadActionWithWriteActionPriority$0(ProgressIndicatorUtils.java:79)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:157)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:119)
    at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:57)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:178)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:688)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:634)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:64)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:165)
    at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:57)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:116)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:79)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.attemptComputation(NonBlockingReadActionImpl.java:486)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$transferToBgThread$1(NonBlockingReadActionImpl.java:408)
    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)
mbolotov commented 3 years ago

Could you please try this version: Cypress Support Pro-2.3.0-SNAPSHOT-2.zip

I just noticed that it did throw a few exceptions

Thanks, I've added a fix for that as well.

rhpkegel commented 3 years ago

Wonderful! This seems to fix my issue. On the subject of unescaped characters however, my colleague did have a similar problem: she cannot run tests with the Cypress runner at all, because her project is located in a directory with a space character, like so: C:\Users\Jane Doe\projects\myProject\src\main\frontend\cypress\integration/**/*. The plugin then fails to load the reporter, like so:

Warning: It looks like you're passing --spec a space-separated list of arguments:
"C:\Users\Jane Doe\projects\myProject\src\main\frontend\cypress\integration/**/*"
This will work, but it's not recommended.
If you are trying to pass multiple arguments, separate them with commas instead:
  cypress run --spec arg1,arg2,arg3
The most common cause of this warning is using an unescaped glob pattern. If you are
trying to pass a glob pattern, escape it using quotes:
  cypress run --spec "**/*.spec.js"
Could not load reporter by name: C:\Users\Jane
We searched for the reporter in these paths:
- C:\Users\Jane
The error we received was:
Cannot find module 'C:\Users\Jane'

Would you like me to create a separate issue for this?

mbolotov commented 3 years ago

Yes, a separate issue would be nice.

mbolotov commented 3 years ago

fixed in 2.3.0 version