Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failures in Before and BeforeAll hooks cause xunit & json reports to fail in parallel mode #4624

Closed
4 tasks done
islembaki opened this issue Apr 8, 2021 · 1 comment · Fixed by #4623
Closed
4 tasks done
Labels
area: parallel mode Regarding parallel mode area: reporters involving a specific reporter type: bug a defect, confirmed by a maintainer

Comments

@islembaki
Copy link

Prerequisites

  • Checked that your issue hasn't already been filed by cross-referencing issues with the faq label
  • Checked next-gen ES issues and syntax problems by using the same environment and/or transpiler configuration without Mocha to ensure it isn't just a feature that actually isn't supported in the environment in question or a bug in your code.
  • 'Smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, your usage of Mocha, or Mocha itself
  • Ensured that there is no discrepancy between the locally and globally installed versions of Mocha. You can find them with: node node_modules/.bin/mocha --version(Local) and mocha --version(Global). We recommend that you not install Mocha globally.

Description

Failures in Before and BeforeAll hooks causes xunit & json report generation to fail in parallel mode

Steps to Reproduce

  • On any test suit with a beforeEach or before hook introduce an intentional failure in the hook
  • Run the test suite with the flag --parallel and --reporter json or --reporter xunit

Expected behavior:

  • Report is generated successfully

Actual behavior:

  • Report is not generated and the following error is thrown

  • When using json reporter

......\node_modules\mocha\lib\reporters\json.js:89
    fullTitle: test.fullTitle(),
                    ^
TypeError: test.fullTitle is not a function
    at clean (C:\Dev\reacts-api-tests\node_modules\mocha\lib\reporters\json.js:89:21)
    at Array.map (<anonymous>)
    at ParallelBufferedRunner.<anonymous> (C:\Dev\reacts-api-tests\node_modules\mocha\lib\reporters\json.js:63:26)
    at Object.onceWrapper (events.js:421:28)
    at ParallelBufferedRunner.emit (events.js:327:22)
    at ParallelBufferedRunner.EventEmitter.emit (domain.js:467:12)
    at C:\Dev\reacts-api-tests\node_modules\mocha\lib\nodejs\parallel-buffered-runner.js:347:14
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
  • when using xunit reporter
....\node_modules\mocha\lib\reporters\xunit.js:159
    classname: test.parent.fullTitle(),
                           ^
TypeError: test.parent.fullTitle is not a function
    at XUnit.test (C:\Dev\reacts-api-tests\node_modules\mocha\lib\reporters\xunit.js:159:28)
    at C:\Dev\reacts-api-tests\node_modules\mocha\lib\reporters\xunit.js:107:12
    at Array.forEach (<anonymous>)
    at ParallelBufferedRunner.<anonymous> (C:\Dev\reacts-api-tests\node_modules\mocha\lib\reporters\xunit.js:106:11)
    at Object.onceWrapper (events.js:421:28)
    at ParallelBufferedRunner.emit (events.js:327:22)
    at ParallelBufferedRunner.EventEmitter.emit (domain.js:467:12)
    at C:\Dev\reacts-api-tests\node_modules\mocha\lib\nodejs\parallel-buffered-runner.js:347:14
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Reproduces how often: 100%

Versions

  • node version v14.15.4
  • mocha version 8.3.2
  • .\node_modules.bin\mocha version 8.3.2
  • Your operating system
    • name and version: Windows 10
    • architecture (32 or 64-bit): 64-bit
  • Your shell (e.g., bash, zsh, PowerShell, cmd): PowerShell
  • Your browser and version (if running browser tests): N/A
  • Any third-party Mocha-related modules (and their versions): N/A
  • Any code transpiler (e.g., TypeScript, CoffeeScript, Babel) being used (and its version): ts-node v9.1.1

Additional Information

@islembaki islembaki changed the title Failures in Before and BeforeAll hooks causes xunit & json reports to fail in parallel mode Failures in Before and BeforeAll hooks cause xunit & json reports to fail in parallel mode Apr 9, 2021
@juergba juergba added type: bug a defect, confirmed by a maintainer area: parallel mode Regarding parallel mode area: reporters involving a specific reporter and removed unconfirmed-bug labels Apr 13, 2021
@juergba
Copy link
Contributor

juergba commented Apr 13, 2021

related #4623

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: parallel mode Regarding parallel mode area: reporters involving a specific reporter type: bug a defect, confirmed by a maintainer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants