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
Change Request: Add "test name" option to ValidTestCase / InvalidTestCase #15090
Comments
How would this work? Are you expecting that the name would be output instead of the code or in addition to it? I’m not opposed to this but it seems unlikely people would use it very often as rules can have a lot of tests and it’s often hard to come up with descriptive names for each test. |
Thx for reply.
I would prefer the name (if present) to be output instead of the code. This would make output more compact.
1: 2: it("The name of the test", () => {
// Test code
}); 3: [
{
code: `
// Test 1
...
`
},
{
code: `
// Test 2
...
`
},
This is true, but I am just using number to distinguish test "Test 1", "Test 2", etc. and it works fine. By the way, I would also suggest "only" option. I find this option both in Jest and in typescript/eslint project and it is very convenient. It helps to quickly disable all tests but one without commenting out other tests. I already have this option because I am using typescript/eslint, but those people who write directly for eslint will apreciate it. |
This option already exist: https://eslint.org/docs/developer-guide/unit-tests#running-individual-tests |
Sorry, probably "only" option was added after I switched to typescript/eslint. But "name" option is still wanted. |
I’m not opposed to adding a name option. Would you be interested in implementing it if we can point you to the code? |
I tried to follow: But when I run "npm test" I get this: If this can be easily solved, I could try to make an edit. Though I would prefer this to be done by somebody familiar with this project. |
@ilyub I'm unable to reproduce this with the master branch. I'd suggest re-syncing with the master branch, removing https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/syncing-a-fork |
I've made #15179 implementing this |
Marking as accepted as it’s a small change with no opposition. |
ESLint version
7.32.0
What problem do you want to solve?
When there are many tests it is easier to find failed test by name than by code.
What do you think is the correct solution?
Add "test name" option to ValidTestCase / InvalidTestCase
Participation
Additional comments
Related issue:
typescript-eslint/typescript-eslint#3920
The text was updated successfully, but these errors were encountered: