From 92f7f899c8f29d03005cd28dfcfaeab6c18f3bee Mon Sep 17 00:00:00 2001 From: roggervalf Date: Wed, 9 Oct 2024 22:21:37 -0500 Subject: [PATCH] chore: enhance test case for deep circular reference --- .../fixtures/fixture_processor_fail_with_circular_reference.js | 3 +++ tests/test_sandboxed_process.ts | 1 + 2 files changed, 4 insertions(+) diff --git a/tests/fixtures/fixture_processor_fail_with_circular_reference.js b/tests/fixtures/fixture_processor_fail_with_circular_reference.js index 447dc47dc8..e472488438 100644 --- a/tests/fixtures/fixture_processor_fail_with_circular_reference.js +++ b/tests/fixtures/fixture_processor_fail_with_circular_reference.js @@ -9,6 +9,9 @@ const delay = require('./delay'); module.exports = function (/*job*/) { return delay(500).then(() => { const error = new Error('error'); + const value = {}; + value.ref = value; + error.custom = value; error.reference = error; throw error; diff --git a/tests/test_sandboxed_process.ts b/tests/test_sandboxed_process.ts index 722198a860..c34bd7d6ee 100644 --- a/tests/test_sandboxed_process.ts +++ b/tests/test_sandboxed_process.ts @@ -969,6 +969,7 @@ function sandboxProcessTests( 'fixture_processor_fail_with_circular_reference.js', ); expect(err.reference).to.equal('[Circular]'); + expect(err.custom).to.deep.equal({ ref: '[Circular]' }); expect(Object.keys(worker['childPool'].retained)).to.have.lengthOf( 0, );