Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Diff is not shown even when two objects are different #793

Closed
shivamdixit opened this issue Mar 21, 2015 · 4 comments
Closed

Diff is not shown even when two objects are different #793

shivamdixit opened this issue Mar 21, 2015 · 4 comments

Comments

@shivamdixit
Copy link
Contributor

For the following deepEqual comparison, no diff is displayed. Is this an expected behavior?

assert.deepEqual(
    {
        d: {
            c: {
                g: {
                    j: {
                        k: {
                            n: {
                                r: "s",
                                s: [ 1, 2, 3, 4 ],
                                t: undefined,
                                u: 1,
                                v: {
                                    w: {
                                        x: {
                                            y: "Hola!",
                                            z: "1"
                                        }
                                    }
                                }
                            },
                            q: [],
                            p: 1 / 0,
                            o: 99
                        },
                        l: undefined,
                        m: null
                    }
                }
            }
        }
    },
    {
        d: {
            c: {
                g: {
                    j: {
                        k: {
                            n: {
                                r: "p",
                                t: undefined,
                                u: 0,
                                s: [ 1, 2, 3 ],
                                v: {
                                    w: {
                                        x: {
                                            z: null,
                                            y: "Yahoo!"
                                        }
                                    }
                                }
                            },
                            o: 99,
                            p: 1 / 0,
                            q: []
                        },
                        l: undefined,
                        m: null
                    }
                }
            }
        }
    }
, true);

Output:
qunit

Diff is also not show in various other complex object assertions too.

@gauravmittal1995
Copy link
Contributor

I think that this is because https://github.com/jquery/qunit/blob/master/src/dump.js#L163#L165. Here since your dept at which the difference is seen is more than the default MaxDepth(5) , It gives [Object object]. Also here the diff is not seen because even though its different (and that's why it gives an error), the displayed text is essentially the same(i.e object Object). If you change the MaxDepth (https://github.com/jquery/qunit/blob/master/src/dump.js#L130) to 7 or 8, it will show a diff.

@shivamdixit
Copy link
Contributor Author

@gauravmittal1995 Thanks, I was not aware of maxDepth property.

@scottgonzalez
Copy link
Contributor

This would require exposing some additional logic, but it might be interesting to show a notice next to the assertion. Potentially even providing a link to rerun the test with a higher max depth.

@shivamdixit
Copy link
Contributor Author

@scottgonzalez I think that's a great idea. Shall I open an issue for the same?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

No branches or pull requests

3 participants