mocha-parallel / mocha-parallel-tests

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

Getting error Unhandled asynchronous exception: Unhandled asynchronous exception instead of specific error #316

Open nikh33 opened 4 months ago

nikh33 commented 4 months ago

I have multiple test files. I want to run them in parallel programmatically. If one of the test files fail with Uncaught exception, testing stops. I checked the source code and saw that you are using process.exit after Uncaught exception I tried to set bail:false but it didn't change anything.

I want to run all test files in parallel and get specific error related to failure instead of Unhandled asynchronous exception: Unhandled asynchronous exception I console reason in setProcessExitListeners function in mocha-parallel-test package dist/util.js file

function setProcessExitListeners() { process.on('unhandledRejection', reason => { const message = reason && 'stack' in reason ? reason.stack : 'Unhandled asynchronous exception'; // eslint-disable-next-line no-console console.error(Unhandled asynchronous exception: ${message}); process.exit(1); }); process.on('uncaughtException', err => { // eslint-disable-next-line no-console console.error(Uncaught exception: ${err.stack}); process.exit(1); }); }

getting { diagnosticText: "tests/integ/data/data.ts(9,41): error TS2551: Property 'atricle1' does not exist on type '{ atricle2: string; }'. Did you mean 'atricle2'?\n", diagnosticCodes: [ 2551 ] }

As reason.stack is undefined getting Unhandled asynchronous exception in error message

can you please help to get error message related to failure