zaqqaz / jest-allure

Generate Allure Report for jest. Allure Report, a flexible lightweight multi-language test report tool with the possibility to add steps, attachments, parameters and so on.
MIT License
113 stars 38 forks source link

Generated reports not compatible with allure2 #46

Open cinderblock opened 4 years ago

cinderblock commented 4 years ago

I'm trying to generate allure reports from the results but allure is giving me an error:
Unknown root element ns2:test-suite.

Example results:

<?xml version='1.0'?>
<ns2:test-suite xmlns:ns2='urn:model.allure.qatools.yandex.ru' start='1580811412000' stop='1580811412079'>
    <name>GitHub Actions Test</name>
    <title>GitHub Actions Test</title>
    <test-cases>
        <test-case start='1580811412001' status='passed' stop='1580811412003'>
            <name>action.yml exists</name>
            <title>action.yml exists</title>
            <labels/>
            <parameters/>
            <steps/>
            <attachments/>
        </test-case>
    </test-cases>
</ns2:test-suite>

Looking around, it looks like maybe allure2 uses json test results instead of xml. Maybe this plugin is only for allure1? But the readme references "allure2". I feel like I'm missing something obvious but I see no references to allure version problems in these issues.

Have people been successful using this with allure2?

My project is FOSS. Checkout the allure verbose output here. Expand the "Generate Allure Report" step to see the output.

zaqqaz commented 4 years ago

Nope, this plugin definitely supports allure 2 https://github.com/allure-framework/allure2 but I never tried this with the first version of the reporter.

Can you provide a bit more info and double check version of the allure?

cinderblock commented 4 years ago

I linked to the repo that is exhibiting the problem with full build logs. I'd be happy to point you to specific things you're looking for.

I believe I'm on allure 2:

https://github.com/cinderblock/github-action-working-directory/blob/ea36ff7ed5392edbdc3a51a86fc71055220f092d/package-lock.json#L1268-L1273


I ended up fixing this by creating my own allure 2 jest result reporter following the allure docs:

https://github.com/cinderblock/github-action-working-directory/blob/master/jest.allure2.js#L1-L10

I am not actually using jest-allure anymore as this was simple enough for me.

zaqqaz commented 4 years ago

@cinderblock got it.

If you still need some additional features of jest-allure you can try clone & run tests https://github.com/zaqqaz/visual-unit-tests here and then type allure serve, I believe that everything should be ok, if not please let me know. Thank you!

ryparker commented 4 years ago

First of all, thanks for creating this package.

Are there any plans to upgrade this module to support recent allure versions? Currently allure-js-commons is version 2.0.0-beta.6 where as this module is still using version 1.3.2. Currently allure results are created as XML and this has some drawbacks such as not supporting PDF attachments. The newest version uses JSON and also supports PDF attachments.

ryparker commented 4 years ago

I ended up forking this repository and implementing the upgraded support. https://github.com/ryparker/jest-allure2

Let me know if you guys would like me to create a PR. Fair warning that the upgrade would be a breaking change for this project.