chiquitinxx / grooscript

Converts your Groovy code to Javascript
https://www.grooscript.org
Other
221 stars 18 forks source link

Problems executing phantomjs tests in windows #10

Closed chiquitinxx closed 11 years ago

chiquitinxx commented 11 years ago

-1 -->System property: C:>echo %PHANTOMJS_HOME% E:\dev\phantomjs\phantomjs-1.9.0

-->But when I run sample PhantomJs example: Using js local files in C:\Users\stevo.grooscript.3.1 Starting PhantomJs test in http://www.grails.org Error PhantomJs Test ->Cannot run program "E:/dev/phantomjs/phantomjs-1.9.0/phantomjs/bin/phantomjs": CreateProcess error=2, The system cannot find the file specified Exception thrown Oct 12, 2013 7:17:23 PM org.codehaus.groovy.runtime.StackTraceUtils sanitize

WARNING: Sanitizing stacktrace:

java.lang.AssertionError: Don't find PhantomJs: Cannot run program "E:/dev/phantomjs/phantomjs-1.9.0/phantomjs/bin/phantomjs": CreateProcess error=2, The system cannot find the file specified. Expression: false

So, there's a problem with path "E:/dev/phantomjs/phantomjs-1.9.0/phantomjs/bin/phantomjs" somehow?

I can fix this I think with System.setProperty('PHANTOMJS_HOME',/E:\dev\phantomjs\phantomjs-1.9.0/) but then:

-2 Using js local files in C:\Users\stevo.grooscript.3.1 Starting PhantomJs test in http://www.grails.org Assert error in PhantomJs test. Exception thrown Oct 12, 2013 7:23:46 PM org.codehaus.groovy.runtime.StackTraceUtils sanitize

WARNING: Sanitizing stacktrace:

java.lang.AssertionError: Fail in inject.. Expression: false ...

it will fail even if I remove all assertions, or if I even empty out the testCountLinks function body :( Can you help?

chiquitinxx commented 11 years ago

PhantomJs.exe in windows isn't in a bin folder in phantomjs distribution. In the js file to run with phantomjs, path have to be defined in unix mode (/path/to/folder), not in dos mode (c:\path). Used System.getProperty("os.name").toUpperCase().contains('WINDOWS') to locate window machines.