Skip to content

Commit

Permalink
[no ci] investigate debug server launching
Browse files Browse the repository at this point in the history
  • Loading branch information
ptrthomas committed May 19, 2022
1 parent 7193815 commit 6d977d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions karate-core/src/test/java/com/intuit/karate/MainRunner.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
package com.intuit.karate;

import org.junit.jupiter.api.Test;
import org.slf4j.LoggerFactory;

/**
*
* @author pthomas3
*/
class MainRunner {

private static final org.slf4j.Logger logger = LoggerFactory.getLogger(MainRunner.class);

@Test
void testCli() {
Main.main(new String[]{"-S"});
}

@Test
void testDebug() {
String temp = "--threads=1 /Users/peter/dev/zcode/karate-todo/src/test/java/app/api/match/test.feature";
Main main = Main.parseKarateOptionsAndQuotePath(temp);

This comment has been minimized.

Copy link
@ptrthomas

ptrthomas May 19, 2022

Author Member

@ivangsa I'm blocked here because I'm implementing debug support for intellij and this is not working

refer changes here: https://github.com/karatelabs/karate/pull/1404/files#r546182298

now I feel accepting that PR was a bad idea and I don't understand the logic at all. heads up, we might be re-writing a bunch of this CLI code

This comment has been minimized.

Copy link
@ivangsa

ivangsa May 20, 2022

Contributor

the logic behind that PR was that VSCode extension was sending the feature name unquoted (hard fact that I could not avoid) so I couldn't add a RuntimeHooks to the command line when feature names contained spaces...

This is what parseKarateOptionAndQuotePath was trying to solve
https://github.com/ivangsa/karate/blob/77f3725bdca24b618a0a2fd57d1df46173fa2599/karate-core/src/test/java/com/intuit/karate/IdeMainTest.java#L91

Right now I'm not worried about unquoted feature names because I can control that on the extension that I maintain, and as far as I know the original VSCode extension it's not using RuntimeHooks or other different cli options

This comment has been minimized.

Copy link
@ptrthomas

ptrthomas May 20, 2022

Author Member

when you say "sending the feature name unquoted" is this only the debug part ? in that case we should change that communication to use a string array

This comment has been minimized.

Copy link
@ivangsa

ivangsa May 20, 2022

Contributor

not sure I understood "change that communication to use a string array"

The bulk of that PR was just to allow RuntimeHooks on the command line for both cli and debug, (not only on the Runner)

About the quoting regular expression... there are infinite ways regular expresions can go wrong, and that one seems to have worked for 1+ year only

What it tries to do is quote the last "non option" string: matches ( -X XXX )* (XXX) quoting the last capturing group

The reason it's not working for your test may be because of the = sign... but adding that to the regex may be cumbersome

I think all IDEs extensions sent the feature name unquoted at that time, so if they contain spaces you could not customize the comand line to configure RuntimeHooks or other options...

This comment has been minimized.

Copy link
@ptrthomas

ptrthomas May 20, 2022

Author Member

okay fine. it is hard for me to understand that regex and the code now, so I may do some changes I see fit. we'll take it as it comes

}

}
1 change: 1 addition & 0 deletions karate-core/src/test/java/logback-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
</appender>

<logger name="com.intuit" level="DEBUG"/>
<logger name="com.intuit.karate.debug" level="TRACE"/>

<root level="warn">
<appender-ref ref="STDOUT" />
Expand Down

0 comments on commit 6d977d4

Please sign in to comment.