mocha-parallel-tests
mocha-parallel-tests copied to clipboard
Test duration is recorded incorrectly by mocha-allure-reporter with mocha-parallel-tests
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 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?
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.
Thanks, I will take a look.
Is this issue fixed by any chance?
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