My test contains something like this:
it.only('does something', function() {
cy.window().then(function(win) {
win.GlobalObject = {
someMethod: function(data) {
return expect(data).to.deep.eq({
company: 'Pied Piperz',
country: 'United States'
});
}
};
});
cy.get('[data-cy=submit]').click();
});
When my test runs, part of the logic invokes window.GlobalObject.someMethod({}) which should fail the test since I didn't pass the expected object into someMethod(). Instead, I see a failing assertion in the log:

But the overall test is marked as succeeding:

How can I get get the failing asserting inside my mocked GlobalObject to fail the whole test?