[valid-describe] Support functions as 'name' argument
See original GitHub issueSince Jest 22 describe()
also allows function references as “name” (instead of a string).
See https://github.com/facebook/jest/pull/5154.
See also the TS typing: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/f79c08624659aea629bf0d1dc2f30a15e2c68383/types/jest/index.d.ts#L390
This is not supported by valid-describe
:
function calc() { /* ... */ }
describe(calc, () => {
it("adds up two values", () => {
// ...
});
});
=> Emits “error First argument must be name jest/valid-describe”.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Create & use named functions - Google Docs Editors Help
Named functions let you create custom functions that can use built-in Sheets formulas. ... For example, the IF function , takes in a...
Read more >Is there a way to provide named parameters in a function call ...
The idea is to parse the parameter names from the string representation of the function so that you can associate the properties of...
Read more >Declare function argument validation - MATLAB arguments
This MATLAB function declares input arguments for a function. ... For instance, define a function that accepts name-value arguments using a structure named...
Read more >Documentation: 15: 4.3. Calling Functions - PostgreSQL
PostgreSQL allows functions that have named parameters to be called using either positional or named notation. Named notation is especially useful for ...
Read more >Function calls | BigQuery - Google Cloud
You can provide parameter arguments by name when calling some functions and ... because the function doesn't support length arguments with negative values....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would just say to give us an option on the rule, to disable checking the name field, since this rule also does other checks as well.
FYI I’m going to be moving this into
valid-title
, just b/c of code structure.From everything I can tell, only
describe
supports names that are notstring
, sovalid-title
will handle checking the title, but have anignoreTypeOfDescribeName
option that should solve this 😃