Skip to content

feat(rule-tester): add support for snapshot testing rules #6994

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

bradzacher
Copy link
Member

@bradzacher bradzacher commented May 6, 2023

PR Checklist

Overview

This PR adds support for snapshot testing rules using a custom, framework agnostic snapshot setup.

The snapshot emits two files for each .run call - a markdown file which is the human-readable results of the test, and a binary file which is a compressed json blob containing the machine-readable snapshot information.

I've done a test migration of our codebase here: https://github.com/typescript-eslint/typescript-eslint/tree/v6-rule-tester-snapshots-migrate-codebase

TODO:

  • finalise snapshot format
  • add docs
  • add a version field so we can do breaking changes to the snapshot object format?
  • add tests to validate it works as intended
  • use filenamify to ensure test names are valid filenames

@bradzacher bradzacher added enhancement New feature or request DO NOT MERGE PRs which should not be merged yet labels May 6, 2023
@typescript-eslint
Copy link
Contributor

Thanks for the PR, @bradzacher!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

@netlify
Copy link

netlify bot commented May 6, 2023

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit ebc8745
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/6455d2f746082900089aad22
😎 Deploy Preview https://deploy-preview-6994--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@nx-cloud
Copy link

nx-cloud bot commented May 6, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit ebc8745. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


🟥 Failed Commands
nx run-many --target=typecheck --parallel
Node 14 - nx test rule-tester --coverage=false
Node 14 - nx test eslint-plugin --coverage=false
✅ Successfully ran 28 targets

Sent with 💌 from NxCloud.

@JoshuaKGoldberg
Copy link
Member

Lots of merge conflicts and this is taking up space in the PR queue. I'm going to close this old draft just to keep the queue small.

@Josh-Cena Josh-Cena deleted the v6-rule-tester-snapshots branch May 31, 2024 18:53
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
DO NOT MERGE PRs which should not be merged yet enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants