diff --git a/lib/internal/assert.js b/lib/internal/assert.js index d151efe3df86ce..36e3bbf57b5613 100644 --- a/lib/internal/assert.js +++ b/lib/internal/assert.js @@ -52,7 +52,8 @@ function inspectValue(val) { // comparison. breakLength: Infinity, // Assert does not detect proxies currently. - showProxy: false + showProxy: false, + sorted: true } ); } diff --git a/test/parallel/test-assert-deep.js b/test/parallel/test-assert-deep.js index 1d8f8fae123318..fab681a89f6a03 100644 --- a/test/parallel/test-assert-deep.js +++ b/test/parallel/test-assert-deep.js @@ -23,7 +23,8 @@ function re(literals, ...values) { depth: 1000, customInspect: false, maxArrayLength: Infinity, - breakLength: Infinity + breakLength: Infinity, + sorted: true }); // Need to escape special characters. result += str; diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index ab09be5ea39316..49fc2b773b79c3 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -293,7 +293,7 @@ testAssertionMessage(-Infinity, '-Infinity'); testAssertionMessage([1, 2, 3], '[\n+ 1,\n+ 2,\n+ 3\n+ ]'); testAssertionMessage(function f() {}, '[Function: f]'); testAssertionMessage(function() {}, '[Function]'); -testAssertionMessage(circular, '{\n+ y: 1,\n+ x: [Circular]\n+ }'); +testAssertionMessage(circular, '{\n+ x: [Circular],\n+ y: 1\n+ }'); testAssertionMessage({ a: undefined, b: null }, '{\n+ a: undefined,\n+ b: null\n+ }'); testAssertionMessage({ a: NaN, b: Infinity, c: -Infinity }, @@ -602,8 +602,8 @@ assert.throws( '\n' + '+ {}\n' + '- {\n' + - "- loop: 'forever',\n" + - '- [Symbol(nodejs.util.inspect.custom)]: [Function]\n' + + '- [Symbol(nodejs.util.inspect.custom)]: [Function],\n' + + "- loop: 'forever'\n" + '- }' }); @@ -870,9 +870,12 @@ common.expectsError( code: 'ERR_ASSERTION', name: 'AssertionError [ERR_ASSERTION]', message: `${start}\n${actExp}\n\n` + - " Comparison {\n name: 'TypeError',\n" + - " message: 'Wrong value',\n+ code: 404\n" + - '- code: 404,\n- foo: undefined\n }' + ' Comparison {\n' + + ' code: 404,\n' + + '- foo: undefined,\n' + + " message: 'Wrong value',\n" + + " name: 'TypeError'\n" + + ' }' } ); @@ -884,9 +887,13 @@ common.expectsError( code: 'ERR_ASSERTION', name: 'AssertionError [ERR_ASSERTION]', message: `${start}\n${actExp}\n\n` + - " Comparison {\n name: 'TypeError',\n" + - " message: 'Wrong value',\n+ code: 404\n" + - "- code: '404',\n- foo: undefined\n }" + ' Comparison {\n' + + '+ code: 404,\n' + + "- code: '404',\n" + + '- foo: undefined,\n' + + " message: 'Wrong value',\n" + + " name: 'TypeError'\n" + + ' }' } ); @@ -916,8 +923,11 @@ common.expectsError( name: 'AssertionError [ERR_ASSERTION]', code: 'ERR_ASSERTION', message: `${start}\n${actExp}\n\n` + - " Comparison {\n+ name: 'TypeError',\n- name: 'Error'," + - "\n message: 'e'\n }" + ' Comparison {\n' + + " message: 'e',\n" + + "+ name: 'TypeError'\n" + + "- name: 'Error'\n" + + ' }' } ); assert.throws( @@ -927,8 +937,11 @@ common.expectsError( code: 'ERR_ASSERTION', generatedMessage: true, message: `${start}\n${actExp}\n\n` + - " Comparison {\n name: 'Error',\n+ message: 'foo'" + - "\n- message: ''\n }" + ' Comparison {\n' + + "+ message: 'foo',\n" + + "- message: '',\n" + + " name: 'Error'\n" + + ' }' } ); diff --git a/test/parallel/test-internal-errors.js b/test/parallel/test-internal-errors.js index dfeca9e693ff60..8d5a2f5cf8798e 100644 --- a/test/parallel/test-internal-errors.js +++ b/test/parallel/test-internal-errors.js @@ -92,7 +92,7 @@ common.expectsError(() => { }, { code: 'ERR_ASSERTION', type: assert.AssertionError, - message: /\+ message: 'Error for testing purposes: a'\n- message: \/\^Error/ + message: /\+ message: 'Error for testing purposes: a',\n- message: \/\^Error/ }); // Test ERR_INVALID_FD_TYPE