Skip to content

Use snapshots for testing rules #56

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
j-f1 opened this issue Dec 16, 2018 · 2 comments
Closed

Use snapshots for testing rules #56

j-f1 opened this issue Dec 16, 2018 · 2 comments
Labels
enhancement New feature or request package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@j-f1
Copy link
Contributor

j-f1 commented Dec 16, 2018

We should use a snapshot system to test rules with each rule having a rule-name.ts fixture that is run through ESLint. Config can be provided by inline /* eslint */ comments, and any reported errors would be dumped to either a Jest snapshot or an errors.json file. We could either switch the test framework from Mocha to Jest or just import Jest’s expect function to get access to the toMatchSnapshot matcher.

@j-f1
Copy link
Contributor Author

j-f1 commented Jan 13, 2019

I’ll push an experimental version at some point, but my current version creates a tests/rules directory with a foo.src.ts source file for the foo rule and foo.snap.ts with a code frame for each rule containing the error message. I’m working on figuring out a way to support messageIds properly since ESLint doesn’t provide the data object.

@JamesHenry JamesHenry transferred this issue from bradzacher/eslint-plugin-typescript Jan 18, 2019
@bradzacher bradzacher added enhancement New feature or request package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin labels Jan 18, 2019
@JamesHenry
Copy link
Member

I don't believe this is currently in our plans, and I would class this as pretty stale at this point, so going to close for now

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

No branches or pull requests

3 participants