qunitjs / qunitjs/qunit

QUnit.dump.parse returns an empty object for Maps

Open
#1,812 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Dump Component: HTML Reporter Type: Bug
Dominant language
JavaScript
Stars
4k
Forks
773
PR merge metrics
No merged PRs in 30d

Description

Version: 2.20.1
Test browser: Chrome 141.0.7390.55

Test cases:

> QUnit.dump.parse([1,3,4])
'[\n  1,\n  3,\n  4\n]'

^^ looks reasonable.

> QUnit.dump.parse({foo: "bar", baz: 2})
'{\n  "baz": 2,\n  "foo": "bar"\n}'

^^ likewise.

> QUnit.dump.parse(new Map([["a","b"], ["c","d"]]))
'{}'

^^ feels like a bug.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the QUnit.dump.parse implementation and its existing tests, then reproduce the Map case shown in the report. Add a regression test covering Map entries and update the behavior so the result represents the provided key-value pairs; the issue is done when the regression test passes in Chrome and the existing array and object cases remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.