mocha-jenkins-reporter icon indicating copy to clipboard operation
mocha-jenkins-reporter copied to clipboard

nested suite name issue

Open ssrakesh opened this issue 5 years ago • 1 comments

If nested suites are used

describe(namespace, () => {
    describe('.sorttest', () => {
        it('should work properly', () => {
       ....
        })
    })
})

output xml will have <testsuite name="namespace .sorttest" ../>

Is it possible to remove space after namespace? like <testsuite name="namespace.sorttest" ../>

ssrakesh avatar Sep 11 '19 08:09 ssrakesh

I have modified jenkines.js file with following changes. this should enable the separator option and use it while adding in xml name and classname attribs

you can include these changes if interested. Note: I have referred mocha-junit-reporter for this change

53a54
>   options.jenkins_suite_title_separator =  process.env.JENKINS_SUITE_TITLE_SEPARATOR || options.jenkins_suite_title_separator;
63a65,80
>   function fullSuiteTitle(suite) {
>     var parent = suite.parent;
>     var title = [ suite.title ];
>   
>     while (parent) {
>       if (parent.root && parent.title === '') {
>         //Nothing to do
>       } else {
>         title.unshift(parent.title);
>       }
>       parent = parent.parent;
>     }
>   
>     return title.join(options.jenkins_suite_title_separator);
>   }
> 
74c91
< 
---
>     let fullTitle = options.jenkins_suite_title_separator ? fullSuiteTitle(currentSuite.suite) : currentSuite.suite.fullTitle()
76c93
<       var imagestring = options.imagestring || htmlEscape(currentSuite.suite.fullTitle());
---
>       var imagestring = options.imagestring || htmlEscape(fullTitle);
94c111
<           name: currentSuite.suite.fullTitle(),
---
>           name: fullTitle,
263a281
>     let fullTitle = options.jenkins_suite_title_separator ? fullSuiteTitle(currentSuite.suite) :currentSuite.suite.fullTitle()
273c291
<       return testPackage + delimiter + suite.fullTitle();
---
>       return testPackage + delimiter + fullTitle;
276c294
<       return options.junit_report_name + '.' + suite.fullTitle();
---
>       return options.junit_report_name + '.' + fullTitle;
278c296
<     return suite.fullTitle();
---
>     return fullTitle;

ssrakesh avatar Sep 16 '19 06:09 ssrakesh