allure-js icon indicating copy to clipboard operation
allure-js copied to clipboard

Mocha-allure v3.0.0-beta.10 isn't compatible with mocha-multi-reporters in parallel mode

Open sophiakulikova opened this issue 5 months ago • 4 comments

Describe the bug The mocha-allure reporter crashes with an error "hook.error is not a function" when running tests in parallel mode

To Reproduce Steps to reproduce the behavior:

  1. Create a simple test mytest.spec.ts
import chai from 'chai';
describe('@my-test-id-000', function () {
    it('@my-test-id-001', function () {
        chai.expect(2).to.equal(2);
    });
});

  1. Run tests with command
node ./node_modules/mocha/bin/mocha --reporter mocha-multi-reporters --reporter-options configFile=reporters.json ./tests/**/mytest.spec.*s --recursive --parallel --jobs 2
  1. The error is displayed in console
  1) Uncaught error outside test suite

  0 passing (2s)
  1 failing

  1) Uncaught error outside test suite:
     Uncaught TypeError: hook.error is not a function
      at updateFunc (node_modules\allure-mocha\src\AllureMochaReporter.ts:288:45)
      at ReporterRuntime.updateFixture (node_modules\allure-js-commons\src\sdk\reporter\ReporterRuntime.ts:166:5)
      at ParallelBufferedRunner.<anonymous> (node_modules\allure-mocha\src\AllureMochaReporter.ts:287:18)
      at ParallelBufferedRunner.emit (node:events:529:35)
      at processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async Promise.allSettled (index 0)

Expected behavior When running tests in parallel mode all test results are correctly reported to the allure report.

Additional context Package.lock dependencies:

"devDependencies": {
    "@babel/core": "7.15.5",
    "@babel/plugin-proposal-class-properties": "7.0.0",
    "@babel/plugin-proposal-decorators": "7.0.0",
    "@babel/plugin-proposal-do-expressions": "7.0.0",
    "@babel/plugin-proposal-export-default-from": "7.0.0",
    "@babel/plugin-proposal-export-namespace-from": "7.0.0",
    "@babel/plugin-proposal-function-bind": "7.0.0",
    "@babel/plugin-proposal-function-sent": "7.0.0",
    "@babel/plugin-proposal-json-strings": "7.0.0",
    "@babel/plugin-proposal-logical-assignment-operators": "7.0.0",
    "@babel/plugin-proposal-nullish-coalescing-operator": "7.0.0",
    "@babel/plugin-proposal-numeric-separator": "7.0.0",
    "@babel/plugin-proposal-optional-chaining": "7.0.0",
    "@babel/plugin-proposal-pipeline-operator": "7.0.0",
    "@babel/plugin-proposal-throw-expressions": "7.0.0",
    "@babel/plugin-syntax-dynamic-import": "7.0.0",
    "@babel/plugin-syntax-import-meta": "7.0.0",
    "@babel/plugin-transform-runtime": "7.12.10",
    "@babel/preset-env": "7.12.1",
    "@babel/preset-typescript": "7.3.3",
    "@babel/register": "7.12.1",
    "@types/axios": "0.14.0",
    "@types/chai": "4.2.19",
    "@types/faker": "6.6.9",
    "@types/json-bigint": "1.0.0",
    "@types/mocha": "10.0.2",
    "@types/node": "18.11.9",
    "allure-commandline": "2.28.0",
    "allure-mocha": "2.15.1",
    "axios": "0.21.1",
    "babel-plugin-module-resolver": "4.1.0",
    "chai": "4.3.10",
    "faker": "5.5.3",
    "js-sha256": "0.9.0",
    "json-bigint": "0.3.1",
    "jsonwebtoken": "8.5.1",
    "mocha": "10.2.0",
    "mocha-multi": "1.1.7",
    "mocha-multi-reporters": "1.5.1",
    "mochawesome": "6.2.1",
    "moment": "2.29.4",
    "moment-timezone": "0.5.41",
    "tv4": "1.3.0",
    "typescript": "4.9.3"
  }

Reporters.json

{
  "reporterEnabled": "mochawesome, allure-mocha",
  "allureMochaReporterOptions": {
    "resultsDir": "./output/allure-results"
  }
}

sophiakulikova avatar Sep 06 '24 16:09 sophiakulikova