mocha-parallel / mocha-parallel-tests

Parallel test runner for mocha tests. Looking for maintainer.
MIT License
199 stars 45 forks source link

Test duration is recorded incorrectly by mocha-allure-reporter with mocha-parallel-tests #246

Open theptyza opened 5 years ago

theptyza commented 5 years ago

I'm trying to run mocha tests in parallel and write output in allure format. However test duration is not recorded correctly in allure results. Simple test: wait for 1s, then pass

const chai = require('chai');
const expect = chai.expect;
const util = require('util');

describe('Suite', function() {
    it('Test', function() {
        return util.promisify(setTimeout)(1000).then(() => {
            expect(true).to.be.true;
        });
    });
});

Command to run mocha-parallel-tests test.js --reporter mocha-allure-reporter Output

<?xml version='1.0'?>
<ns2:test-suite xmlns:ns2='urn:model.allure.qatools.yandex.ru' start='1559917772335' stop='1559917772335'>
    <name>Suite</name>
    <title>Suite</title>
    <test-cases>
        <test-case start='1559917772335' status='passed' stop='1559917772335'>
            <name>Test</name>
            <title>Test</title>
            <labels/>
            <parameters/>
            <steps/>
            <attachments/>
        </test-case>
    </test-cases>
</ns2:test-suite>

Test start and stop timestamps are the same, so test duration is 0. Is this a known limitation with mocha-allure-reporter?

1999 commented 5 years ago

@theptyza thanks for posting this issue. We had some issues in the past with allure reporter because of its global variables shared between the test suites. What mocha and mocha-parallel-tests versions are you using?

theptyza commented 5 years ago

I'm using mocha-parallel-tests 2.1.2 and mocha-allure-reporter 1.4.0. I've tested this with mocha 4.1.0, 5.2.0 and 6.1.4.

1999 commented 5 years ago

Thanks, I will take a look.

paparaju commented 3 years ago

Is this issue fixed by any chance?

dprantl03 commented 3 years ago

This seems to also be happening with Mocha's own version of parallel running as of v8.0 using the --parallel flag. https://github.com/allure-framework/allure-mocha/issues/65