Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

HTMLFormatter with Windows and feature names beginning with 'x' #375

Closed
john-mccloskey opened this Issue · 0 comments

2 participants

@john-mccloskey

Hi,

I've noticed that if I have a feature or folder beginning with the character 'x' when I try to view a html report generated on Windows nothing is displayed.

I've narrowed the problem down to be in the generation of report.js. When using Ubuntu or OS X the file separator is '/' and in the report.js there is the following for example:

formatter.uri('MavenCucumber/xHelloWorld.feature');

The html report displays fine. Switch over to Windows and the file separator of '\' results in following ending up in report.js

formatter.uri('MavenCucumber\xHelloWorld.feature');

Leaving the index.html displaying a blank page. It seems to be treating the "\x" as an escape sequence for URIs leading to a malformed URI exception in the browser.I also found a Stack Overflow post of someone having a similar problem with the 'u' character.

By the time writeToJsReport is called the parameter 'arg' already has the file separator for the given OS in the string so to quickly check that the backslashes are really the problem I modified the method to look like this:

private void writeToJsReport(String functionName, String arg) {
    if(arg.contains(".feature")){
        arg = arg.replace('\\','/');
    }
    jsOut().append(JS_FORMATTER_VAR + ".").append(functionName).append("(").append(arg).append(");").println();
}

And as a result the html report displays correctly on Windows. There is probably a better place to fix this though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.