Skip to content

'to satisfy' with circular data causes "Maximum call stack size exceeded" #694

@salomvary

Description

@salomvary

Given this added to test/unexpected.spec.js:

describe('bug', () => {
  it('fails for FormData with "Maximum call stack size exceeded"', () => {
    expect(new FormData(), 'to satisfy', new FormData());
  });

  it('fails for URLSearchParams with "Maximum call stack size exceeded"', () => {
    expect(new URLSearchParams(), 'to satisfy', new URLSearchParams());
  });

  it.skip('even worse, this seems to never complete in Jest (Jest neither fails nort exist)', () => {
    expect(new Image(), 'to satisfy', new Image());
  });
});

npx jest -- test/unexpected.spec.js on the latest master of this repo fails with an exception:

npx jest -- test/unexpected.spec.js 

 RUNS  test/unexpected.spec.js
/Users/martonsalomvary/unexpected/lib/workQueue.js:28
        throw that.reason();
        ^

RangeError: Maximum call stack size exceeded
    at prepareStackTrace (internal/errors.js:37:29)
    at Function.getOwnPropertyDescriptor (<anonymous>)
    at Object.propertyIsWritable (/Users/martonsalomvary/unexpected/node_modules/unexpected-bluebird/js/main/es5.js:17:37)
    at canAttachTrace (/Users/martonsalomvary/unexpected/node_modules/unexpected-bluebird/js/main/util.js:248:40)
    at Object.ensureErrorObject (/Users/martonsalomvary/unexpected/node_modules/unexpected-bluebird/js/main/util.js:260:17)
    at Promise._rejectCallback (/Users/martonsalomvary/unexpected/node_modules/unexpected-bluebird/js/main/promise.js:465:22)
    at Promise._resolveFromResolver (/Users/martonsalomvary/unexpected/node_modules/unexpected-bluebird/js/main/promise.js:489:17)
    at new Promise (/Users/martonsalomvary/unexpected/node_modules/unexpected-bluebird/js/main/promise.js:69:37)
    at Function.makePromise [as promise] (/Users/martonsalomvary/unexpected/lib/makePromise.js:17:10)
    at /Users/martonsalomvary/unexpected/lib/assertions.js:1955:36
    at Array.forEach (<anonymous>)
    at Object.handler (/Users/martonsalomvary/unexpected/lib/assertions.js:1936:18)
    at Function.Object.<anonymous>.expectPrototype._executeExpect (/Users/martonsalomvary/unexpected/lib/createTopLevelExpect.js:1462:36)
    at /Users/martonsalomvary/unexpected/lib/createTopLevelExpect.js:1345:20
    at Function.Object.<anonymous>.expectPrototype._callInNestedContext (/Users/martonsalomvary/unexpected/lib/createTopLevelExpect.js:1743:30)
    at wrappedExpect (/Users/martonsalomvary/unexpected/lib/createTopLevelExpect.js:1344:26)
    at /Users/martonsalomvary/unexpected/lib/assertions.js:1960:20
    at /Users/martonsalomvary/unexpected/lib/makePromise.js:65:34
    at tryCatcher (/Users/martonsalomvary/unexpected/node_modules/unexpected-bluebird/js/main/util.js:26:23)
    at Promise._resolveFromResolver (/Users/martonsalomvary/unexpected/node_modules/unexpected-bluebird/js/main/promise.js:476:31)
    at new Promise (/Users/martonsalomvary/unexpected/node_modules/unexpected-bluebird/js/main/promise.js:69:37)
    at Function.makePromise [as promise] (/Users/martonsalomvary/unexpected/lib/makePromise.js:17:10)
    at /Users/martonsalomvary/unexpected/lib/assertions.js:1955:36
    at Array.forEach (<anonymous>)

[TRUNCATED]

Using Node.js v12.14.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions