Skip to content

console.table on array-of-arrays renders spurious 'Values' column #1276

Description

@proggeramlug

Summary

`console.table` of an array-of-arrays input adds a spurious `Values` column that Node omits when every row is itself an array.

Repro

```ts
console.table([[1, 2], [3, 4]]);
```

Observed (v0.5.1019)

```
┌─────────┬───┬───┬────────┐
│ (index) │ 0 │ 1 │ Values │
├─────────┼───┼───┼────────┤
│ 0 │ 1 │ 2 │ │
│ 1 │ 3 │ 4 │ │
└─────────┴───┴───┴────────┘
```

Expected (`node --experimental-strip-types`)

```
┌─────────┬───┬───┐
│ (index) │ 0 │ 1 │
├─────────┼───┼───┤
│ 0 │ 1 │ 2 │
│ 1 │ 3 │ 4 │
└─────────┴───┴───┘
```

Suspected root cause

Node's `console.table` formatter has a special-case: when every row is an Array (vs. a plain object), the `Values` column is suppressed because the array indices already cover the data. Perry's formatter appears to append the `Values` column unconditionally, then emit empty cells for it.

Fix shape

In the table-formatter (likely in `perry-runtime/src/console.rs` or similar), detect the pure-array-row case and skip the `Values` column. Roughly: `if rows.iter().all(|r| matches!(r, JsValue::Array(_))) { skip_values_column = true; }`.

Surfaced by

CI parity gate on tag `v0.5.1019` (run 26236443275), via `test_gap_console_methods.ts`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed defect or regressionparityCompatibility gap with Node.js, ECMAScript, or the supported ecosystem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions