- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 33.7k
 
Closed
Labels
assertIssues and PRs related to the assert subsystem.Issues and PRs related to the assert subsystem.
Description
See these examples:
First:
assert.deepStrictEqual([1, 2, 1, 2, 1], [1, 1, 1])
AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
+ actual - expected
  [
    1,
+   2,
+   1,
+   2,
-   1,
    1
  ]
It should actually print:
assert.deepStrictEqual([1, 2, 1, 2, 1], [1, 1, 1])
AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
+ actual - expected
  [
    1,
+   2,
    1,
+   2,
    1
  ]
Second example:
> assert.deepStrictEqual([1, { a: true, b: false }, 1], [2, 1, { b: false, a: true }, 2])
AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
+ actual - expected
  [
+   1,
+   {
+     a: true,
+     b: false
+   },
+   1
-   2,
-   1,
-   {
-     a: true,
-     b: false
-   },
-   2
  ]
Should be:
> assert.deepStrictEqual([1, { a: true, b: false }, 1], [2, 1, { b: false, a: true }, 2])
AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
+ actual - expected
  [
-   2,
    1,
    {
      a: true,
      b: false
    },
+   1
-   2
  ]
Already fixed part
$ ./node -e 'assert.deepStrictEqual({a: 1, b: 2}, {a: 1, b: 2, c: 3})'
assert.js:84
  throw new AssertionError(obj);
  ^
AssertionError [ERR_ASSERTION]: Expected inputs to be strictly deep-equal:
+ actual - expected
  {
    a: 1,
+   b: 2
-   b: 2,
-   c: 3
  }
I think I would expect more something like this:
+ actual - expected
  {
    a: 1,
    b: 2,
-   c: 3
  }
Metadata
Metadata
Assignees
Labels
assertIssues and PRs related to the assert subsystem.Issues and PRs related to the assert subsystem.