jquery / jquery/esprima

infrastructure: move unit-test to stable JSON stringify

Open
#2,060 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.1k
Forks
773
PR merge metrics
No merged PRs in 30d

Description

Now unit-test uses JSON.stringify to generate fixtures.

JSON.stringify is not stable across different environment (Node versions/platform).

This means, when there is a new property added to ESTree nodes, and we want to regenerate fixtures for existing unit tests, the generated fixtures would mostly be largely mismatched to the original one, which makes it hard to review.

It's better to stabilize the output, then it's easier for the dev process.

We can leverage existing libraries like https://github.com/substack/json-stable-stringify or https://github.com/epoberezkin/fast-json-stable-stringify.

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

Locate the unit-test fixture generation that currently calls JSON.stringify and review how existing fixtures are regenerated. Compare json-stable-stringify or fast-json-stable-stringify, then verify that regenerated fixtures remain stable across Node versions and that the unit tests still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
testing-qa
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.