Search code examples
javascriptjasminejasmine-node

Jasmine false positive with {} and [] in jasmine-node


For some reason jasmine's...

expect({}).toEqual([]);

is reporting true (but they are different types). How do I do this check with jasmine?


Solution

  • You can move the equality check within the expect clause:

    a = {}
    b = []
    expect(a === b).toBeTruthy();