| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -780,10 +780,20 @@ function getPrefix(constructor, tag, fallback, size = '') { | |||
| 780 | 780 | return `[${fallback}${size}: null prototype] `; | |
| 781 | 781 | } | |
| 782 | 782 | ||
| 783 | - if (tag !== '' && constructor !== tag) { | ||
| 784 | - return `${constructor}${size} [${tag}] `; | ||
| 783 | + let result = `${constructor}${size} `; | ||
| 784 | + if (tag !== '') { | ||
| 785 | + const position = constructor.indexOf(tag); | ||
| 786 | + if (position === -1) { | ||
| 787 | + result += `[${tag}] `; | ||
| 788 | + } else { | ||
| 789 | + const endPos = position + tag.length; | ||
| 790 | + if (endPos !== constructor.length && | ||
| 791 | + constructor[endPos] === constructor[endPos].toLowerCase()) { | ||
| 792 | + result += `[${tag}] `; | ||
| 793 | + } | ||
| 794 | + } | ||
| 785 | 795 | } | |
| 786 | - return `${constructor}${size} `; | ||
| 796 | + return result; | ||
| 787 | 797 | } | |
| 788 | 798 | ||
| 789 | 799 | // Look up the keys of the object. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,7 @@ describe('ESM: loader with syntax error', { concurrency: !process.env.TEST_PARAL | |||
| 13 | 13 | path('print-error-message.js'), | |
| 14 | 14 | ]); | |
| 15 | 15 | ||
| 16 | - match(stderr, /SyntaxError \[Error\]:/); | ||
| 16 | + match(stderr, /SyntaxError/); | ||
| 17 | 17 | ok(!stderr.includes('Bad command or file name')); | |
| 18 | 18 | notStrictEqual(code, 0); | |
| 19 | 19 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1415,11 +1415,11 @@ if (typeof Symbol !== 'undefined') { | |||
| 1415 | 1415 | assert.strictEqual(util.inspect(new ArraySubclass(1, 2, 3)), | |
| 1416 | 1416 | 'ArraySubclass(3) [ 1, 2, 3 ]'); | |
| 1417 | 1417 | assert.strictEqual(util.inspect(new SetSubclass([1, 2, 3])), | |
| 1418 | - 'SetSubclass(3) [Set] { 1, 2, 3 }'); | ||
| 1418 | + 'SetSubclass(3) { 1, 2, 3 }'); | ||
| 1419 | 1419 | assert.strictEqual(util.inspect(new MapSubclass([['foo', 42]])), | |
| 1420 | - "MapSubclass(1) [Map] { 'foo' => 42 }"); | ||
| 1420 | + "MapSubclass(1) { 'foo' => 42 }"); | ||
| 1421 | 1421 | assert.strictEqual(util.inspect(new PromiseSubclass(() => {})), | |
| 1422 | - 'PromiseSubclass [Promise] { <pending> }'); | ||
| 1422 | + 'PromiseSubclass { <pending> }'); | ||
| 1423 | 1423 | assert.strictEqual(util.inspect(new SymbolNameClass()), | |
| 1424 | 1424 | 'Symbol(name) {}'); | |
| 1425 | 1425 | assert.strictEqual( | |
@@ -1430,6 +1430,29 @@ if (typeof Symbol !== 'undefined') { | |||
| 1430 | 1430 | util.inspect(Object.setPrototypeOf(x, null)), | |
| 1431 | 1431 | '[ObjectSubclass: null prototype] { foo: 42 }' | |
| 1432 | 1432 | ); | |
| 1433 | + | ||
| 1434 | + class MiddleErrorPart extends Error {} | ||
| 1435 | + assert(util.inspect(new MiddleErrorPart('foo')).includes('MiddleErrorPart: foo')); | ||
| 1436 | + | ||
| 1437 | + class MapClass extends Map {} | ||
| 1438 | + assert.strictEqual(util.inspect(new MapClass([['key', 'value']])), | ||
| 1439 | + "MapClass(1) { 'key' => 'value' }"); | ||
| 1440 | + | ||
| 1441 | + class AbcMap extends Map {} | ||
| 1442 | + assert.strictEqual(util.inspect(new AbcMap([['key', 'value']])), | ||
| 1443 | + "AbcMap(1) { 'key' => 'value' }"); | ||
| 1444 | + | ||
| 1445 | + class SetAbc extends Set {} | ||
| 1446 | + assert.strictEqual(util.inspect(new SetAbc([1, 2, 3])), | ||
| 1447 | + 'SetAbc(3) { 1, 2, 3 }'); | ||
| 1448 | + | ||
| 1449 | + class FooSet extends Set {} | ||
| 1450 | + assert.strictEqual(util.inspect(new FooSet([1, 2, 3])), | ||
| 1451 | + 'FooSet(3) { 1, 2, 3 }'); | ||
| 1452 | + | ||
| 1453 | + class Settings extends Set {} | ||
| 1454 | + assert.strictEqual(util.inspect(new Settings([1, 2, 3])), | ||
| 1455 | + 'Settings(3) [Set] { 1, 2, 3 }'); | ||
| 1433 | 1456 | } | |
| 1434 | 1457 | ||
| 1435 | 1458 | // Empty and circular before depth. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments