Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: support biome for jest-snapshot formatting #15014

Open
mnahkies opened this issue Apr 6, 2024 · 3 comments
Open

[Feature]: support biome for jest-snapshot formatting #15014

mnahkies opened this issue Apr 6, 2024 · 3 comments

Comments

@mnahkies
Copy link

mnahkies commented Apr 6, 2024

馃殌 Feature Proposal

Detect and use biome (https://biomejs.dev/) for the formatting/indentation of inline snapshots generated by jest-snapshot

Alternatively, throw an exception when:

  • No prettier package is installed/found
  • And, prettierPath is undefined (eg: not explicitly set to null)

Motivation

I've recently migrated some projects from using prettier to biome for formatting, which in inadvertently broke the indentation of jest inline-snapshots.

This wasn't immediately apparent/obvious, and it was only stumbling across #14305 that made me realize that removing prettier as a dependency had caused this.

Example

No response

Pitch

I appreciate from looking at the PR implementing support for prettier@3 that introducing first class biome support might be more complexity / core bloat than it's worth (though I do think it would be nice).

The alternative of throwing an error though would've saved me a lot of confusion / frustration - I had no idea that jest-snapshot relied on prettier, and since the snapshot indentation changes only happened when snapshots needed updating, there was a gap between the break being introduced and being visible.

(ie: https://github.com/mnahkies/openapi-code-generator/pull/129/files#diff-64237f590faccbee856b106612fd72c8d370d7bd5aafc38c489f62b692344617 replaced prettier with biome, but the snapshots were not altered yet)

mnahkies added a commit to mnahkies/openapi-code-generator that referenced this issue Apr 6, 2024
- includes `minimum` / `maximum` on the numeric ir model
- uses these to add validations with `zod`
- add `prettier` to fix bad inline-snapshot indentation (see
  jestjs/jest#15014)
- memorize openapi validator in unit tests, speeding them up
  considerably (`~6s` -> `~1s` for the zod spec file)
mnahkies added a commit to mnahkies/openapi-code-generator that referenced this issue Apr 6, 2024
- includes `minimum` / `maximum` on the numeric ir model
- uses these to add validations with `zod`
- add `prettier` to fix bad inline-snapshot indentation (see
jestjs/jest#15014)
- memorize openapi validator in unit tests, speeding them up
considerably (`~6s` -> `~1s` for the zod spec file)
- improve test harness for zod to support directly providing `IRModel`
objects, and also execute the resulting schemas to parse a value
- this makes it easier to write a broader range of tests, and should
also prevent misunderstandings of the zod API

Partially addresses #51
Copy link

github-actions bot commented May 6, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label May 6, 2024
@mnahkies
Copy link
Author

mnahkies commented May 6, 2024

Not stale

@github-actions github-actions bot removed the Stale label May 6, 2024
@SimenB
Copy link
Member

SimenB commented May 6, 2024

Yeah, I don't have any interest in supporting Biome out of the box (unless it's trivial - happy to take a PR in that case).

Why can you not set it to null?

EDIT: I guess you might not know you need to - I don't think the loss of auto indented snapshots for prettier users are worth supporting the waaay lower user base of biome. Happy to take ideas in how to improve the experience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants