Conversation
|
Hey @smainil, just in an attempt to implement it myself, perhaps you can take a look at this one if you have time. Much appreciated! |
|
@Gijsreyn I just had a quick look to your changes and it's more or less what I tried to do the other day. It works as expected only if you analyze a single file. If you analyze more than one file the content of the junit report is overwritten again and again and will only content the result of the last analyzed file. you should not create the content of the file as a plain text but use an xmlBuilder module like this const doc = create({ version: '1.0', encoding: 'UTF-8' })
.ele('testsuites');
const suite = doc.ele('testsuite', { name: filenameForOutput });
if (err) suite.ele('error', { message: err })
else {
for (const result of results) {
const test = suite.ele('testcase', { classname: result.link, name: result.link, time: 0 });
if (result.status !== 'dead') continue;
else {
if (result.err != null) {
test.ele('error', {
message: result.err,
type: 'error'
});
} else {
test.ele('error', {
message: result.err
?? `${result.link} is ${result.status} (${result.statusCode})`,
type: result.status
});
}
}
}
}
fs.writeFileSync('junit.xml', doc.end({ prettyPrint: true }) + '\n');3 last working days before holidays and time to find a way to solve the problem |
|
Great catch, I hadn't actually tried that one out. I skipped the module part as per previous PR, as I thought it gave problems of earlier releases... |
|
Mind giving it another stab @smainil? I have just updated the code to use xmlBuilder. |
|
@Gijsreyn Going to have a look to it |
|
it works really good. 👏 I would like to find a way to make it more generic and not junit only related |
Understood! For now, I have updated the code with your remarks. Do you want to do that in this PR or a different one? |
Seems good for now in this PR. The current code is now more generic. Only the variables needed for the junit reporters are defined in the junit reporters |
|
@WillGibson @BaseMax the code proposed by @Gijsreyn is good for me (but I am not a nodejs expert :-)) can you have a look to the changes please before I merge ? |
|
Hey @WillGibson, @BaseMax or @smainil, is this ready to be pulled in and get released :)? |
|
@Gijsreyn Changes are merged to master |
|
@tcort could you publish a new version now that these changes are on the master branch ? Thx |
Thanks a lot! |
|
@tcort - just checking in. Would it be possible to publish a new release with these changes? Would really help us to test it out in an Azure DevOps pipeline. Thanks a lot! |
This PR addresses #424. To not break the build from #364, I simply added a
junitreported to thereportersobjet, allowing to report on: