| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e449571 commit 13d6597
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -637,7 +637,7 @@ function addPrototypeProperties(ctx, main, obj, recurseTimes, output) { | |||
| 637 | 637 | ||
| 638 | 638 | function getPrefix(constructor, tag, fallback, size = '') { | |
| 639 | 639 | if (constructor === null) { | |
| 640 | - if (tag !== '') { | ||
| 640 | + if (tag !== '' && fallback !== tag) { | ||
| 641 | 641 | return `[${fallback}${size}: null prototype] [${tag}] `; | |
| 642 | 642 | } | |
| 643 | 643 | return `[${fallback}${size}: null prototype] `; | |
@@ -971,7 +971,7 @@ function formatRaw(ctx, value, recurseTimes, typedArray) { | |||
| 971 | 971 | braces[0] = `${getPrefix(constructor, tag, 'WeakMap')}{`; | |
| 972 | 972 | formatter = ctx.showHidden ? formatWeakMap : formatWeakCollection; | |
| 973 | 973 | } else if (isModuleNamespaceObject(value)) { | |
| 974 | - braces[0] = `[${tag}] {`; | ||
| 974 | + braces[0] = `${getPrefix(constructor, tag, 'Module')}{`; | ||
| 975 | 975 | // Special handle keys for namespace objects. | |
| 976 | 976 | formatter = formatNamespaceObject.bind(null, keys); | |
| 977 | 977 | } else if (isBoxedPrimitive(value)) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,21 @@ | |||
| 1 | 1 | // Flags: --experimental-loader ./test/fixtures/es-module-loaders/loader-with-custom-condition.mjs | |
| 2 | 2 | import '../common/index.mjs'; | |
| 3 | 3 | import assert from 'assert'; | |
| 4 | + import util from 'util'; | ||
| 4 | 5 | ||
| 5 | 6 | import * as ns from '../fixtures/es-modules/conditional-exports.mjs'; | |
| 6 | 7 | ||
| 7 | 8 | assert.deepStrictEqual({ ...ns }, { default: 'from custom condition' }); | |
| 9 | + | ||
| 10 | + assert.strictEqual( | ||
| 11 | + util.inspect(ns, { showHidden: false }), | ||
| 12 | + "[Module: null prototype] { default: 'from custom condition' }" | ||
| 13 | + ); | ||
| 14 | + | ||
| 15 | + assert.strictEqual( | ||
| 16 | + util.inspect(ns, { showHidden: true }), | ||
| 17 | + '[Module: null prototype] {\n' + | ||
| 18 | + " default: 'from custom condition',\n" + | ||
| 19 | + " [Symbol(Symbol.toStringTag)]: 'Module'\n" + | ||
| 20 | + '}' | ||
| 21 | + ); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,7 +16,10 @@ child.stdout.on('data', (data) => { | |||
| 16 | 16 | ||
| 17 | 17 | child.on('exit', common.mustCall(() => { | |
| 18 | 18 | const results = output.replace(/^> /mg, '').split('\n').slice(2); | |
| 19 | - assert.deepStrictEqual(results, ['[Module] { message: \'A message\' }', '']); | ||
| 19 | + assert.deepStrictEqual( | ||
| 20 | + results, | ||
| 21 | + ['[Module: null prototype] { message: \'A message\' }', ''] | ||
| 22 | + ); | ||
| 20 | 23 | })); | |
| 21 | 24 | ||
| 22 | 25 | child.stdin.write('await import(\'./message.mjs\');\n'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,10 @@ const { inspect } = require('util'); | |||
| 11 | 11 | await m.link(() => 0); | |
| 12 | 12 | assert.strictEqual( | |
| 13 | 13 | inspect(m.namespace), | |
| 14 | - '[Module] { a: <uninitialized>, b: undefined }'); | ||
| 14 | + '[Module: null prototype] { a: <uninitialized>, b: undefined }'); | ||
| 15 | 15 | await m.evaluate(); | |
| 16 | - assert.strictEqual(inspect(m.namespace), '[Module] { a: 1, b: 2 }'); | ||
| 16 | + assert.strictEqual( | ||
| 17 | + inspect(m.namespace), | ||
| 18 | + '[Module: null prototype] { a: 1, b: 2 }' | ||
| 19 | + ); | ||
| 17 | 20 | })().then(common.mustCall()); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments