Skip to content

test: handle null-prototype json fields#1080

Merged
tunnckoCore merged 1 commit intomasterfrom
test/json-null-prototype
Apr 16, 2026
Merged

test: handle null-prototype json fields#1080
tunnckoCore merged 1 commit intomasterfrom
test/json-null-prototype

Conversation

@tunnckoCore
Copy link
Copy Markdown
Member

Summary

  • update the JSON integration test for null-prototype field objects
  • assert the hardened object shape explicitly

Why this was breaking

PR #1066 changed parsed fields/files objects to use Object.create(null) to avoid prototype clobbering.

test/integration/json.test.js was still comparing the returned fields value against a plain object literal with assert.deepStrictEqual(). That assertion checks prototypes too, so the test failed even though the printed contents looked identical.

The thrown assertion then prevented the test from reaching res.end(), server.close(), and done(), which is why Jest also reported a timeout.

Fix

  • assert Object.getPrototypeOf(fields) === null
  • compare { ...fields } to the expected plain object contents

@tunnckoCore tunnckoCore merged commit 13fb801 into master Apr 16, 2026
8 of 10 checks passed
@tunnckoCore tunnckoCore deleted the test/json-null-prototype branch April 16, 2026 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant