mocha-parallel-tests icon indicating copy to clipboard operation
mocha-parallel-tests copied to clipboard

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

Open theptyza opened this issue 5 years ago • 5 comments

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?

theptyza avatar Jun 07 '19 15:06 theptyza

@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?

1999 avatar Jun 08 '19 21:06 1999

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.

theptyza avatar Jun 09 '19 09:06 theptyza

Thanks, I will take a look.

1999 avatar Jun 10 '19 01:06 1999

Is this issue fixed by any chance?

paparaju avatar Dec 04 '20 00:12 paparaju

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

dprantl03 avatar Dec 04 '20 21:12 dprantl03