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
jest.mock import rule? #1346
Comments
No we do not - if you'd like such a rule, could you give some more details on your use case(s) and some examples? (I know it sounds obvious, but sometimes there are hidden behaviours that are easy to miss until you dig a bit deeper) |
I realized I don't need such a thing any more, but I was wanting something that would check that the module path for a relative module within the jest.mock function was an absolute path. Given a project (lets call it SuperFunProject) that makes use of typescript aliasing and absolute imports that contains a react component and service API: // ServiceA.ts
export const getData = () => {};
// ReactComponentB.ts
import { getData } from "SuperFunProject/services/ServiceA";
// ReactComponentB.test.ts
jest.mock(""); **<---------**
it("should test stuff", () => {}); The absolute path here in jest.mock would be "SuperFunProject/services/ServiceA" instead of a relative one which could be "../services/ServiceA". A eslint rule to check this is what I am looking for. Thank you for your quick response and curiosity! |
I think it it still necessary:
|
@richardaum what you've put is a propose for Jest - could you reframe to focus on Overall I think we should look into having a rule for |
Does this package have the ability to check that the import string within jest.mock is an absolute import vs relative?
The text was updated successfully, but these errors were encountered: