Skip to content

The return value of async function is not an instance of Promise #551

@R31K4G3

Description

@R31K4G3

When calling an async function, the returned value is expected to be a Promise.
However, p instanceof Promise is false in version 3.10.0 to 3.10.5.

const { VM } = require("vm2");

const vm = new VM();

const result = vm.run(`
async function f() {}

const p = f();

p instanceof Promise
`);

// Output: false
console.log(result);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions