Skip to content

Node 10.0.0 Object.values() returns incorrect array #20278

Closed
@raymondfeng

Description

@raymondfeng
  • Version: v10.0.0
  • Platform: Darwin Kernel Version 17.5.0: Mon Mar 5 22:24:32 PST 2018; root:xnu-4570.51.1~1/RELEASE_X86_64 x86_64

To reproduce the problem, create the following js files:

  1. values.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class X {
}
exports.X = X;
  1. test.js
const x = require('./values.js');
console.log(x);
console.log(Object.values(x));
  1. test1.js
const x = require('./values.js');
console.log(Object.values(x));

Now node test prints:

{ X: [Function: X] }
[]

Interestingly, node test1 prints:

[ [Function: X] ]

Please note Object.values(x) in test.js returns []. I expect it to print:

{ X: [Function: X] }
[ [Function: X] ]

I tried Node 8.x, both test and test1 work as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.v8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions