question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[valid-describe] Support functions as 'name' argument

See original GitHub issue

Since 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:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
garykingcommented, Oct 17, 2019

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.

1reaction
G-Rathcommented, Oct 26, 2019

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 not string, so valid-title will handle checking the title, but have an ignoreTypeOfDescribeName option that should solve this 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found