GeezerVison is showing github.com — util: inspect: enumerable Symbols no longer have square brackets · nodejs/node@e577618
File treeExpand file treeCollapse file tree Open diff view settings fixtures/test-runner/output
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: doc/api/assert.md +2-2Lines changed: 2 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -878,7 +878,7 @@ assert.deepStrictEqual({ [symbol1]: 1 }, { [symbol2]: 1 }); | 878 | 878 | // AssertionError [ERR_ASSERTION]: Inputs identical but not reference equal: | 879 | 879 | // | 880 | 880 | // { | 881 | | -// [Symbol()]: 1 | | 881 | +// Symbol(): 1 | 882 | 882 | // } | 883 | 883 |
| 884 | 884 | const weakMap1 = new WeakMap(); | @@ -970,7 +970,7 @@ assert.deepStrictEqual({ [symbol1]: 1 }, { [symbol2]: 1 }); | 970 | 970 | // AssertionError [ERR_ASSERTION]: Inputs identical but not reference equal: | 971 | 971 | // | 972 | 972 | // { | 973 | | -// [Symbol()]: 1 | | 973 | +// Symbol(): 1 | 974 | 974 | // } | 975 | 975 |
| 976 | 976 | const weakMap1 = new WeakMap(); | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/events.md +4-4Lines changed: 4 additions & 4 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -73,8 +73,8 @@ myEmitter.on('event', function(a, b) { | 73 | 73 | // _events: [Object: null prototype] { event: [Function (anonymous)] }, | 74 | 74 | // _eventsCount: 1, | 75 | 75 | // _maxListeners: undefined, | 76 | | - // [Symbol(shapeMode)]: false, | 77 | | - // [Symbol(kCapture)]: false | | 76 | + // Symbol(shapeMode): false, | | 77 | + // Symbol(kCapture): false | 78 | 78 | // } true | 79 | 79 | }); | 80 | 80 | myEmitter.emit('event', 'a', 'b'); | @@ -91,8 +91,8 @@ myEmitter.on('event', function(a, b) { | 91 | 91 | // _events: [Object: null prototype] { event: [Function (anonymous)] }, | 92 | 92 | // _eventsCount: 1, | 93 | 93 | // _maxListeners: undefined, | 94 | | - // [Symbol(shapeMode)]: false, | 95 | | - // [Symbol(kCapture)]: false | | 94 | + // Symbol(shapeMode): false, | | 95 | + // Symbol(kCapture): false | 96 | 96 | // } true | 97 | 97 | }); | 98 | 98 | myEmitter.emit('event', 'a', 'b'); | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/util/inspect.js +6-11Lines changed: 6 additions & 11 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1999,21 +1999,16 @@ function formatProperty(ctx, value, recurseTimes, key, type, desc, | 1999 | 1999 | SymbolPrototypeToString(key), | 2000 | 2000 | escapeFn, | 2001 | 2001 | ); | 2002 | | - name = `[${ctx.stylize(tmp, 'symbol')}]`; | 2003 | | - } else if (key === '__proto__') { | 2004 | | - name = "['__proto__']"; | 2005 | | - } else if (desc.enumerable === false) { | 2006 | | - const tmp = RegExpPrototypeSymbolReplace( | 2007 | | - strEscapeSequencesReplacer, | 2008 | | - key, | 2009 | | - escapeFn, | 2010 | | - ); | 2011 | | - name = `[${tmp}]`; | | 2002 | + name = ctx.stylize(tmp, 'symbol'); | 2012 | 2003 | } else if (RegExpPrototypeExec(keyStrRegExp, key) !== null) { | 2013 | | - name = ctx.stylize(key, 'name'); | | 2004 | + name = key === '__proto__' ? "['__proto__']" : ctx.stylize(key, 'name'); | 2014 | 2005 | } else { | 2015 | 2006 | name = ctx.stylize(strEscape(key), 'string'); | 2016 | 2007 | } | | 2008 | + | | 2009 | + if (desc.enumerable === false) { | | 2010 | + name = `[${name}]`; | | 2011 | + } | 2017 | 2012 | return `${name}:${extra}${str}`; | 2018 | 2013 | } | 2019 | 2014 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/test-runner/output/describe_it.snapshot +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -454,7 +454,7 @@ not ok 50 - custom inspect symbol that throws fail | 454 | 454 | error: |- | 455 | 455 | { | 456 | 456 | foo: 1, | 457 | | - [Symbol(nodejs.util.inspect.custom)]: [Function: [nodejs.util.inspect.custom]] | | 457 | + Symbol(nodejs.util.inspect.custom): [Function: [nodejs.util.inspect.custom]] | 458 | 458 | } | 459 | 459 | code: 'ERR_TEST_FAILURE' | 460 | 460 | ... | |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/test-runner/output/dot_reporter.snapshot +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -137,7 +137,7 @@ Failed tests: | 137 | 137 | ✖ custom inspect symbol fail (*ms) | 138 | 138 | customized | 139 | 139 | ✖ custom inspect symbol that throws fail (*ms) | 140 | | - { foo: 1, [Symbol(nodejs.util.inspect.custom)]: [Function: [nodejs.util.inspect.custom]] } | | 140 | + { foo: 1, Symbol(nodejs.util.inspect.custom): [Function: [nodejs.util.inspect.custom]] } | 141 | 141 | ✖ sync throw fails at first (*ms) | 142 | 142 | Error: thrown from subtest sync throw fails at first | 143 | 143 | * | |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/test-runner/output/junit_reporter.snapshot +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -319,15 +319,15 @@ Error [ERR_TEST_FAILURE]: thrown from callback async throw | 319 | 319 | [Error [ERR_TEST_FAILURE]: customized] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: customized } | 320 | 320 | </failure> | 321 | 321 | </testcase> | 322 | | - <testcase name="custom inspect symbol that throws fail" time="*" classname="test" failure="{ foo: 1, [Symbol(nodejs.util.inspect.custom)]: [Function: [nodejs.util.inspect.custom]]}"> | 323 | | - <failure type="testCodeFailure" message="{ foo: 1, [Symbol(nodejs.util.inspect.custom)]: [Function: [nodejs.util.inspect.custom]]}"> | | 322 | + <testcase name="custom inspect symbol that throws fail" time="*" classname="test" failure="{ foo: 1, Symbol(nodejs.util.inspect.custom): [Function: [nodejs.util.inspect.custom]]}"> | | 323 | + <failure type="testCodeFailure" message="{ foo: 1, Symbol(nodejs.util.inspect.custom): [Function: [nodejs.util.inspect.custom]]}"> | 324 | 324 | [Error [ERR_TEST_FAILURE]: { | 325 | 325 | foo: 1, | 326 | | - [Symbol(nodejs.util.inspect.custom)]: [Function: [nodejs.util.inspect.custom]] | | 326 | + Symbol(nodejs.util.inspect.custom): [Function: [nodejs.util.inspect.custom]] | 327 | 327 | }] { | 328 | 328 | code: 'ERR_TEST_FAILURE', | 329 | 329 | failureType: 'testCodeFailure', | 330 | | - cause: { foo: 1, [Symbol(nodejs.util.inspect.custom)]: [Function: [nodejs.util.inspect.custom]] } | | 330 | + cause: { foo: 1, Symbol(nodejs.util.inspect.custom): [Function: [nodejs.util.inspect.custom]] } | 331 | 331 | } | 332 | 332 | </failure> | 333 | 333 | </testcase> | |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/test-runner/output/output.snapshot +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -502,7 +502,7 @@ not ok 51 - custom inspect symbol that throws fail | 502 | 502 | error: |- | 503 | 503 | { | 504 | 504 | foo: 1, | 505 | | - [Symbol(nodejs.util.inspect.custom)]: [Function: [nodejs.util.inspect.custom]] | | 505 | + Symbol(nodejs.util.inspect.custom): [Function: [nodejs.util.inspect.custom]] | 506 | 506 | } | 507 | 507 | code: 'ERR_TEST_FAILURE' | 508 | 508 | ... | |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/test-runner/output/output_cli.snapshot +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -509,7 +509,7 @@ not ok 51 - custom inspect symbol that throws fail | 509 | 509 | error: |- | 510 | 510 | { | 511 | 511 | foo: 1, | 512 | | - [Symbol(nodejs.util.inspect.custom)]: [Function: [nodejs.util.inspect.custom]] | | 512 | + Symbol(nodejs.util.inspect.custom): [Function: [nodejs.util.inspect.custom]] | 513 | 513 | } | 514 | 514 | code: 'ERR_TEST_FAILURE' | 515 | 515 | ... | |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/test-runner/output/spec_reporter.snapshot +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 194 | 194 | customized | 195 | 195 |
| 196 | 196 | custom inspect symbol that throws fail (*ms) | 197 | | - { foo: 1, [Symbol(nodejs.util.inspect.custom)]: [Function: [nodejs.util.inspect.custom]] } | | 197 | + { foo: 1, Symbol(nodejs.util.inspect.custom): [Function: [nodejs.util.inspect.custom]] } | 198 | 198 |
| 199 | 199 | subtest sync throw fails | 200 | 200 | sync throw fails at first (*ms) | | 476 | 476 |
| 477 | 477 | * | 478 | 478 | custom inspect symbol that throws fail (*ms) | 479 | | - { foo: 1, [Symbol(nodejs.util.inspect.custom)]: [Function: [nodejs.util.inspect.custom]] } | | 479 | + { foo: 1, Symbol(nodejs.util.inspect.custom): [Function: [nodejs.util.inspect.custom]] } | 480 | 480 |
| 481 | 481 | * | 482 | 482 | sync throw fails at first (*ms) | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-assert.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -801,7 +801,7 @@ test('Test strict assert', () => { | 801 | 801 | '\n' + | 802 | 802 | '+ {}\n' + | 803 | 803 | '- {\n' + | 804 | | - '- [Symbol(nodejs.util.inspect.custom)]: [Function (anonymous)],\n' + | | 804 | + '- Symbol(nodejs.util.inspect.custom): [Function (anonymous)],\n' + | 805 | 805 | "- loop: 'forever'\n" + | 806 | 806 | '- }\n' | 807 | 807 | }); | |
|