| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e192ba1 commit 91c8624
8 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -224,8 +224,11 @@ function jsToYaml(indent, name, value, seen) { | |||
| 224 | 224 | } | |
| 225 | 225 | ||
| 226 | 226 | if (errIsAssertion) { | |
| 227 | - result += jsToYaml(indent, 'expected', errExpected, seen); | ||
| 228 | - result += jsToYaml(indent, 'actual', errActual, seen); | ||
| 227 | + // Note that we're deliberately creating shallow copies of the `seen` | ||
| 228 | + // set here in order to isolate the discovery of circular references | ||
| 229 | + // within the expected and actual properties respectively. | ||
| 230 | + result += jsToYaml(indent, 'expected', errExpected, new SafeSet(seen)); | ||
| 231 | + result += jsToYaml(indent, 'actual', errActual, new SafeSet(seen)); | ||
| 229 | 232 | if (errOperator) { | |
| 230 | 233 | result += jsToYaml(indent, 'operator', errOperator, seen); | |
| 231 | 234 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -422,35 +422,51 @@ Error [ERR_TEST_FAILURE]: bar | |||
| 422 | 422 | } | |
| 423 | 423 | </failure> | |
| 424 | 424 | </testcase> | |
| 425 | - <testcase name="assertion errors display actual and expected properly" time="*" classname="test" failure="Expected values to be loosely deep-equal:{ bar: 1, foo: 1}should loosely deep-equal<ref *1> { bar: 2, c: [Circular *1]}"> | ||
| 426 | - <failure type="testCodeFailure" message="Expected values to be loosely deep-equal:{ bar: 1, foo: 1}should loosely deep-equal<ref *1> { bar: 2, c: [Circular *1]}"> | ||
| 425 | + <testcase name="assertion errors display actual and expected properly" time="*" classname="test" failure="Expected values to be loosely deep-equal:{ bar: 1, boo: [ 1 ], foo: 1}should loosely deep-equal{ boo: [ 1 ], circular: <ref *1> { bar: 2, c: [Circular *1] }}"> | ||
| 426 | + <failure type="testCodeFailure" message="Expected values to be loosely deep-equal:{ bar: 1, boo: [ 1 ], foo: 1}should loosely deep-equal{ boo: [ 1 ], circular: <ref *1> { bar: 2, c: [Circular *1] }}"> | ||
| 427 | 427 | [Error [ERR_TEST_FAILURE]: Expected values to be loosely deep-equal: | |
| 428 | 428 | ||
| 429 | 429 | { | |
| 430 | 430 | bar: 1, | |
| 431 | + boo: [ | ||
| 432 | + 1 | ||
| 433 | + ], | ||
| 431 | 434 | foo: 1 | |
| 432 | 435 | } | |
| 433 | 436 | ||
| 434 | 437 | should loosely deep-equal | |
| 435 | 438 | ||
| 436 | - <ref *1> { | ||
| 437 | - bar: 2, | ||
| 438 | - c: [Circular *1] | ||
| 439 | + { | ||
| 440 | + boo: [ | ||
| 441 | + 1 | ||
| 442 | + ], | ||
| 443 | + circular: <ref *1> { | ||
| 444 | + bar: 2, | ||
| 445 | + c: [Circular *1] | ||
| 446 | + } | ||
| 439 | 447 | }] { | |
| 440 | 448 | code: 'ERR_TEST_FAILURE', | |
| 441 | 449 | failureType: 'testCodeFailure', | |
| 442 | 450 | cause: AssertionError [ERR_ASSERTION]: Expected values to be loosely deep-equal: | |
| 443 | 451 | ||
| 444 | 452 | { | |
| 445 | 453 | bar: 1, | |
| 454 | + boo: [ | ||
| 455 | + 1 | ||
| 456 | + ], | ||
| 446 | 457 | foo: 1 | |
| 447 | 458 | } | |
| 448 | 459 | ||
| 449 | 460 | should loosely deep-equal | |
| 450 | 461 | ||
| 451 | - <ref *1> { | ||
| 452 | - bar: 2, | ||
| 453 | - c: [Circular *1] | ||
| 462 | + { | ||
| 463 | + boo: [ | ||
| 464 | + 1 | ||
| 465 | + ], | ||
| 466 | + circular: <ref *1> { | ||
| 467 | + bar: 2, | ||
| 468 | + c: [Circular *1] | ||
| 469 | + } | ||
| 454 | 470 | } | |
| 455 | 471 | * { | |
| 456 | 472 | generatedMessage: true, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -694,6 +694,7 @@ DA:388,1 | |||
| 694 | 694 | DA:389,1 | |
| 695 | 695 | DA:390,1 | |
| 696 | 696 | DA:391,1 | |
| 697 | - LH:389 | ||
| 698 | - LF:391 | ||
| 697 | + DA:392,1 | ||
| 698 | + LH:390 | ||
| 699 | + LF:392 | ||
| 699 | 700 | end_of_record | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -382,8 +382,9 @@ test('assertion errors display actual and expected properly', async () => { | |||
| 382 | 382 | circular.c = circular; | |
| 383 | 383 | const tmpLimit = Error.stackTraceLimit; | |
| 384 | 384 | Error.stackTraceLimit = 1; | |
| 385 | + const boo = [1]; | ||
| 385 | 386 | try { | |
| 386 | - assert.deepEqual({ foo: 1, bar: 1 }, circular); // eslint-disable-line no-restricted-properties | ||
| 387 | + assert.deepEqual({ foo: 1, bar: 1, boo }, { boo, circular }); // eslint-disable-line no-restricted-properties | ||
| 387 | 388 | } catch (err) { | |
| 388 | 389 | Error.stackTraceLimit = tmpLimit; | |
| 389 | 390 | throw err; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -643,23 +643,36 @@ not ok 61 - assertion errors display actual and expected properly | |||
| 643 | 643 | ||
| 644 | 644 | { | |
| 645 | 645 | bar: 1, | |
| 646 | + boo: [ | ||
| 647 | + 1 | ||
| 648 | + ], | ||
| 646 | 649 | foo: 1 | |
| 647 | 650 | } | |
| 648 | 651 | ||
| 649 | 652 | should loosely deep-equal | |
| 650 | 653 | ||
| 651 | - <ref *1> { | ||
| 652 | - bar: 2, | ||
| 653 | - c: [Circular *1] | ||
| 654 | + { | ||
| 655 | + boo: [ | ||
| 656 | + 1 | ||
| 657 | + ], | ||
| 658 | + circular: <ref *1> { | ||
| 659 | + bar: 2, | ||
| 660 | + c: [Circular *1] | ||
| 661 | + } | ||
| 654 | 662 | } | |
| 655 | 663 | code: 'ERR_ASSERTION' | |
| 656 | 664 | name: 'AssertionError' | |
| 657 | 665 | expected: | |
| 658 | - bar: 2 | ||
| 659 | - c: <Circular> | ||
| 666 | + boo: | ||
| 667 | + 0: 1 | ||
| 668 | + circular: | ||
| 669 | + bar: 2 | ||
| 670 | + c: <Circular> | ||
| 660 | 671 | actual: | |
| 661 | 672 | foo: 1 | |
| 662 | 673 | bar: 1 | |
| 674 | + boo: | ||
| 675 | + 0: 1 | ||
| 663 | 676 | operator: 'deepEqual' | |
| 664 | 677 | stack: |- | |
| 665 | 678 | * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -643,23 +643,36 @@ not ok 61 - assertion errors display actual and expected properly | |||
| 643 | 643 | ||
| 644 | 644 | { | |
| 645 | 645 | bar: 1, | |
| 646 | + boo: [ | ||
| 647 | + 1 | ||
| 648 | + ], | ||
| 646 | 649 | foo: 1 | |
| 647 | 650 | } | |
| 648 | 651 | ||
| 649 | 652 | should loosely deep-equal | |
| 650 | 653 | ||
| 651 | - <ref *1> { | ||
| 652 | - bar: 2, | ||
| 653 | - c: [Circular *1] | ||
| 654 | + { | ||
| 655 | + boo: [ | ||
| 656 | + 1 | ||
| 657 | + ], | ||
| 658 | + circular: <ref *1> { | ||
| 659 | + bar: 2, | ||
| 660 | + c: [Circular *1] | ||
| 661 | + } | ||
| 654 | 662 | } | |
| 655 | 663 | code: 'ERR_ASSERTION' | |
| 656 | 664 | name: 'AssertionError' | |
| 657 | 665 | expected: | |
| 658 | - bar: 2 | ||
| 659 | - c: <Circular> | ||
| 666 | + boo: | ||
| 667 | + 0: 1 | ||
| 668 | + circular: | ||
| 669 | + bar: 2 | ||
| 670 | + c: <Circular> | ||
| 660 | 671 | actual: | |
| 661 | 672 | foo: 1 | |
| 662 | 673 | bar: 1 | |
| 674 | + boo: | ||
| 675 | + 0: 1 | ||
| 663 | 676 | operator: 'deepEqual' | |
| 664 | 677 | stack: |- | |
| 665 | 678 | * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -263,14 +263,22 @@ | |||
| 263 | 263 | ||
| 264 | 264 | { | |
| 265 | 265 | bar: 1, | |
| 266 | + boo: [ | ||
| 267 | + 1 | ||
| 268 | + ], | ||
| 266 | 269 | foo: 1 | |
| 267 | 270 | } | |
| 268 | 271 | ||
| 269 | 272 | should loosely deep-equal | |
| 270 | 273 | ||
| 271 | - <ref *1> { | ||
| 272 | - bar: 2, | ||
| 273 | - c: [Circular *1] | ||
| 274 | + { | ||
| 275 | + boo: [ | ||
| 276 | + 1 | ||
| 277 | + ], | ||
| 278 | + circular: <ref *1> { | ||
| 279 | + bar: 2, | ||
| 280 | + c: [Circular *1] | ||
| 281 | + } | ||
| 274 | 282 | } | |
| 275 | 283 | * { | |
| 276 | 284 | generatedMessage: true, | |
@@ -528,14 +536,22 @@ | |||
| 528 | 536 | ||
| 529 | 537 | { | |
| 530 | 538 | bar: 1, | |
| 539 | + boo: [ | ||
| 540 | + 1 | ||
| 541 | + ], | ||
| 531 | 542 | foo: 1 | |
| 532 | 543 | } | |
| 533 | 544 | ||
| 534 | 545 | should loosely deep-equal | |
| 535 | 546 | ||
| 536 | - <ref *1> { | ||
| 537 | - bar: 2, | ||
| 538 | - c: [Circular *1] | ||
| 547 | + { | ||
| 548 | + boo: [ | ||
| 549 | + 1 | ||
| 550 | + ], | ||
| 551 | + circular: <ref *1> { | ||
| 552 | + bar: 2, | ||
| 553 | + c: [Circular *1] | ||
| 554 | + } | ||
| 539 | 555 | } | |
| 540 | 556 | * { | |
| 541 | 557 | generatedMessage: true, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -263,20 +263,28 @@ | |||
| 263 | 263 | ||
| 264 | 264 | { | |
| 265 | 265 | bar: 1, | |
| 266 | + boo: [ | ||
| 267 | + 1 | ||
| 268 | + ], | ||
| 266 | 269 | foo: 1 | |
| 267 | 270 | } | |
| 268 | 271 | ||
| 269 | 272 | should loosely deep-equal | |
| 270 | 273 | ||
| 271 | - <ref *1> { | ||
| 272 | - bar: 2, | ||
| 273 | - c: [Circular *1] | ||
| 274 | + { | ||
| 275 | + boo: [ | ||
| 276 | + 1 | ||
| 277 | + ], | ||
| 278 | + circular: <ref *1> { | ||
| 279 | + bar: 2, | ||
| 280 | + c: [Circular *1] | ||
| 281 | + } | ||
| 274 | 282 | } | |
| 275 | 283 | * { | |
| 276 | 284 | generatedMessage: true, | |
| 277 | 285 | code: 'ERR_ASSERTION', | |
| 278 | - actual: { foo: 1, bar: 1 }, | ||
| 279 | - expected: <ref *1> { bar: 2, c: [Circular *1] }, | ||
| 286 | + actual: { foo: 1, bar: 1, boo: [ 1 ] }, | ||
| 287 | + expected: { boo: [ 1 ], circular: <ref *1> { bar: 2, c: [Circular *1] } }, | ||
| 280 | 288 | operator: 'deepEqual' | |
| 281 | 289 | } | |
| 282 | 290 | ||
@@ -528,20 +536,28 @@ | |||
| 528 | 536 | ||
| 529 | 537 | { | |
| 530 | 538 | bar: 1, | |
| 539 | + boo: [ | ||
| 540 | + 1 | ||
| 541 | + ], | ||
| 531 | 542 | foo: 1 | |
| 532 | 543 | } | |
| 533 | 544 | ||
| 534 | 545 | should loosely deep-equal | |
| 535 | 546 | ||
| 536 | - <ref *1> { | ||
| 537 | - bar: 2, | ||
| 538 | - c: [Circular *1] | ||
| 547 | + { | ||
| 548 | + boo: [ | ||
| 549 | + 1 | ||
| 550 | + ], | ||
| 551 | + circular: <ref *1> { | ||
| 552 | + bar: 2, | ||
| 553 | + c: [Circular *1] | ||
| 554 | + } | ||
| 539 | 555 | } | |
| 540 | 556 | * { | |
| 541 | 557 | generatedMessage: true, | |
| 542 | 558 | code: 'ERR_ASSERTION', | |
| 543 | - actual: { foo: 1, bar: 1 }, | ||
| 544 | - expected: <ref *1> { bar: 2, c: [Circular *1] }, | ||
| 559 | + actual: { foo: 1, bar: 1, boo: [ 1 ] }, | ||
| 560 | + expected: { boo: [ 1 ], circular: <ref *1> { bar: 2, c: [Circular *1] } }, | ||
| 545 | 561 | operator: 'deepEqual' | |
| 546 | 562 | } | |
| 547 | 563 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments