Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

📎 Unify internal testing strategy #4650

Closed
ematipico opened this issue Jul 3, 2023 · 0 comments
Closed

📎 Unify internal testing strategy #4650

ematipico opened this issue Jul 3, 2023 · 0 comments
Labels
A-Tooling Area: our own build, development, and release tooling good first issue Good for newcomers Help wanted Help would be really appreciated task A task, an action that needs to be performed
Milestone

Comments

@ematipico
Copy link
Contributor

Description

At the moment we have different ways to test stuff in our internal crates, and they are different from each other:

  • the parser tests use the testing strategy inherited from rslint. It works but it requires to steps (files generation and snapshot update). There's no way to pass configuration/options to the code;
  • the formatter tests use the insta snapshots. There's a way to pass options but it doesn't follow the configuration, we should use the rome.json configuration instead;
  • the linter testing infra is the the most up to date one, and I believe that's the one we should follow: it uses the insta snapshots and it accepts a rome.json configuration;

The idea would be to create an internal crate where we could create generic testing utilities where:

  • the utility read files from a folder (like in the analyzer)
  • the consumer parses the files like they want, because we support different files (JS, JSON, etc.)
  • the utility reads a *.options.json file inside that folder and tries to de-serialize it into a Configuration type;
  • the consumer extracts the information from Configuration;
  • the utility exposes an utility to write snapshots;
  • the consumer can write snapshots like it wants;
  • the utility writes the snapshot to disk;

Ideally, as a starting point, we can copy what we have inside the rome_js_analyze, make it generic and then change the code inside rome_js_analyze/tests and rome_json_analyze/tests.

Then we should move to:

  1. rome_json_formatter
  2. rome_js_formatter
  3. rome_json_parser
  4. rome_js_parser

I would mark this issue as "good first issue" but I would expect some knowledge of Rust to begin with.

@ematipico ematipico added the task A task, an action that needs to be performed label Jul 3, 2023
@ematipico ematipico added this to the v13.0.0 milestone Jul 3, 2023
@ematipico ematipico added Help wanted Help would be really appreciated A-Tooling Area: our own build, development, and release tooling good first issue Good for newcomers labels Jul 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Tooling Area: our own build, development, and release tooling good first issue Good for newcomers Help wanted Help would be really appreciated task A task, an action that needs to be performed
Projects
None yet
Development

No branches or pull requests

1 participant