-
Notifications
You must be signed in to change notification settings - Fork 240
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
Intention of global aliases #1252
Comments
A more complete example as to why this causes an issue for me would be a pattern like:
In the above case I have a test in each aliased describe section with the same name. Because my alias is not picked up as a describe alias, I get a "duplicate title" error as the tests in each sub-suite have the same title. This scenario is when I'm using jest to run system tests against different environments where one, both or none of the above sub-suites may be relevant in any given environment. I was hoping I could simply add the following settings to my .eslintrc.js to resolve:
|
It's because it expects them to be global aliases - I'm not really that comfortable with extending this support out further given its already a stretch and you can resolve this by creating a setup file that assigns See #83 and jestjs/jest#2468 (comment) for more There's a few ways you can agree your advance case, such as having a function global (i.e.
|
Thanks Gareth, I can look at other approaches to my needs that dont interfere as you suggest. |
Hi,
I often define my own conditional implementations of describe or it where I might have something like:
so I tried setting
relevantTests
as a global alias for describe in settings but it is ignored because of this code inresolveToJestFn
insrc/rules/utils/parseJestFnCall.ts
:If I remove that code then my aliased describe function is correctly identified as an alias for describe.
I'm happy to submit a PR but clearly that code was deliberately added for a reason and just removing it may not be the right solution. Or maybe my understanding of the purpose of the globalAliases setting is incorrect.
Cheers,
Tim
The text was updated successfully, but these errors were encountered: