Skip to content

RangeError when comparing two objects with eql #139

Description

@l0b0

I'd like to use eql to compare two objects:

expect(tokenizeTagText(text)).to.eql([new TextField('only text field')]);

But I get this using mocha:

RangeError: Maximum call stack size exceeded

However, if I change the test to use equal, they look the same:

Error: expected [ { name: 'only text field',
markup: { '0': <input value="only text field">, length: 1 } } ] to equal [ { name: 'only text field',
markup: { '0': <input value="only text field">, length: 1 } } ]

It seems the RangeError comes from expect.js.

It seems the issue is with comparing jQuery elements:

it('failing', function () {
    expect([ { name: 'only text field',
            markup: { '0': $('<input value="only text field">'), length: 1 } } ]).to.eql([ { name: 'only text field',
            markup: { '0': $('<input value="only text field">'), length: 1 } } ]);
});
it('successful', function () {
    expect([ { name: 'only text field',
            markup: { '0': '<input value="only text field">', length: 1 } } ]).to.eql([ { name: 'only text field',
            markup: { '0': '<input value="only text field">', length: 1 } } ]);
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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