jest icon indicating copy to clipboard operation
jest copied to clipboard

[Feature]: support biome for jest-snapshot formatting

Open mnahkies opened this issue 1 year ago • 4 comments

🚀 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 https://github.com/jestjs/jest/issues/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 avatar Apr 06 '24 09:04 mnahkies

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[bot] avatar May 06 '24 10:05 github-actions[bot]

Not stale

mnahkies avatar May 06 '24 10:05 mnahkies

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.

SimenB avatar May 06 '24 13:05 SimenB

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[bot] avatar Jun 05 '24 14:06 github-actions[bot]

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

github-actions[bot] avatar Jul 05 '24 15:07 github-actions[bot]

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

github-actions[bot] avatar Jul 05 '24 15:07 github-actions[bot]

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

github-actions[bot] avatar Aug 06 '24 00:08 github-actions[bot]