Skip to content

Commit

Permalink
chore: enhance test case for deep circular reference
Browse files Browse the repository at this point in the history
  • Loading branch information
roggervalf committed Oct 12, 2024
1 parent fd7d6f5 commit 92f7f89
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions tests/test_sandboxed_process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand Down

0 comments on commit 92f7f89

Please sign in to comment.