Open WetHippie opened 11 years ago
First, I think it's always safer for you to use <baseDir>http://localhost:${jasmine.serverPort}</baseDir>
, since you have to use the same port that Jasmine is using. Having said that, however, I have to point out that I don't think that's the right way to configure the port for Jasmine, this one works though:
<properties>
<jasmine.serverPort>8000</jasmine.serverPort>
</properties>
And then use it in baseDir
as usual, so that both Jasmine and Saga can pick it up.
Note that Jasmine is using the port that I told it to through the
There's two possible solutions to the problem here - base URL needs to treat the URL as a proper base and not internally look for a jasmine-maven-plugin specific property. If it does, it gets the right port number specified without having to do any other lookups. The alternative is to change the config property name to be baseFilePath and use it only for files, and then have another property called jasmineHostName and only have the host name (though that will mess with paranoid companies like mine require absolutely everything HTTPS....)
I have started trying to work out what the saga code is doing, but haven't yet got the hang of how it's all put together to make any guesses.
If you read the jasmine-maven-plugin docs, you'll see that it says the following about the serverPort property:
The jasmine:test goal always uses a random available port so this property is ignored.
So, even though you are completely right in saying that jasmine:bdd uses the property you are setting, it's not going to make any difference to the jasmine:test goal, since it always uses a random port.
This is understandable, since there is no reason for the user to care about the port being used for the jasmine:test goal, since they won't be looking at the tests manually anyway.
Saga, on the other hand, doesn't care about the port/hostname/anything else – it's going to use whatever you provide per the baseDir
property as the URL, parsing the whole thing, and definitely not skipping some of the parts :smile_cat:
BTW, I guess when I said that the aforementioned POM snippet "worked" I was mistaken: somehow, even though Saga reports that it's running tests at port 8000, it runs them correctly, even though the Jetty that the jasmine-maven-plugin starts up spits out completely random ports (which is understandable if you look at the code, since the property would be set after the port is chosen).
When combined with the jasmine-maven-plugin with a configuration set to a non-default port, the Saga plugin does not correctly find any outputs.
For example, modifying the stock example that's available as a download as such:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
Running mvn verify on this results in the following output:
18:42:12.784 [pool-2-thread-1] INFO com.github.timurstrekalov.saga.core.TestRunCoverageStatisticsCallable - Running test at http://localhost:1235 18:42:13.305 [pool-2-thread-1] WARN com.github.timurstrekalov.saga.core.TestRunCoverageStatisticsCallable - No actual test run for file: http://localhost:1235 18:42:13.305 [pool-2-thread-1] INFO com.github.timurstrekalov.saga.core.TestRunCoverageStatisticsCallable - Quitting browser 18:42:13.306 [main] INFO com.github.timurstrekalov.saga.core.DefaultCoverageGenerator - Test run finished
If you take out the port number, the tests correctly find a report to work with.