-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
synapsecns/synapse-contracts
#95Labels
area: parallel modeRegarding parallel modeRegarding parallel modestatus: accepting prsMocha can use your help with this one!Mocha can use your help with this one!type: buga defect, confirmed by a maintainera defect, confirmed by a maintainer
Description
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) andmocha --version
(Global). We recommend that you not install Mocha globally.
Description
Parallel mode crashes or hangs if test exception contains circular references
Steps to Reproduce
1. Hangs if error has self reference:
Test file test.js
describe('Test', () => {
it('test', () => {
const error = new Error('Foo');
error.self = error;
throw error;
});
});
Running following will simply hang:
$ mocha --parallel test.js
2. Crashes if error has circular references passed within array properties
Test file test.js
describe('Test', () => {
it('test', () => {
const error = new Error('Foo');
error.foo = { props: [] };
error.foo.props.push(error.foo);
throw error;
});
});
Running following
$ mocha --parallel test.js
will result with an error as:
1) Uncaught error outside test suite
0 passing (308ms)
1 failing
1) Uncaught error outside test suite:
Uncaught TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| property 'props' -> object with constructor 'Array'
--- index 0 closes the circle
at stringify (<anonymous>)
at writeChannelMessage (node:internal/child_process/serialization:120:20)
at process.target._send (node:internal/child_process:819:17)
at process.target.send (node:internal/child_process:719:19)
at processTicksAndRejections (node:internal/process/task_queues:93:5)
Expected behavior:
Originally thrown exception should surface in report
Versions
- The output of
mocha --version
andnode node_modules/.bin/mocha --version
: 8.2.1 - The output of
node --version
: 15.5.1 - Your operating system
- name and version: macOS 10.15.7
- architecture (32 or 64-bit): 64-bit
- Your shell (e.g., bash, zsh, PowerShell, cmd): zsh
pgrzesik, asztal, paco0x, simon-neusoft, davidtperk and 3 more
Metadata
Metadata
Assignees
Labels
area: parallel modeRegarding parallel modeRegarding parallel modestatus: accepting prsMocha can use your help with this one!Mocha can use your help with this one!type: buga defect, confirmed by a maintainera defect, confirmed by a maintainer