diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index b32529b8c071dd..59236853cc6c72 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -847,10 +847,11 @@ function getBoxedBase(value, ctx, keys, constructor, tag) { function getFunctionBase(value, constructor, tag) { let type = 'Function'; + if (isGeneratorFunction(value)) { + type = `Generator${type}`; + } if (isAsyncFunction(value)) { - type = 'AsyncFunction'; - } else if (isGeneratorFunction(value)) { - type = 'GeneratorFunction'; + type = `Async${type}`; } let base = `[${type}`; if (constructor === null) { diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 7133cc59acba41..80a612ede53050 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -48,6 +48,10 @@ assert.strictEqual(util.inspect(async () => {}), '[AsyncFunction]'); util.inspect(fn), '[GeneratorFunction]' ); + assert.strictEqual( + util.inspect(async function* abc() {}), + '[AsyncGeneratorFunction: abc]' + ); Object.setPrototypeOf(fn, Object.getPrototypeOf(async () => {})); assert.strictEqual( util.inspect(fn),