Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

no-mocks-import.md 731B

123456789101112131415161718192021222324252627
  1. # Disallow manually importing from `__mocks__` (`no-mocks-import`)
  2. When using `jest.mock`, your tests (just like the code being tested) should
  3. import from `./x`, not `./__mocks__/x`. Not following this rule can lead to
  4. confusion, because you will have multiple instances of the mocked module:
  5. ```js
  6. jest.mock('./x');
  7. const x1 = require('./x');
  8. const x2 = require('./__mocks__/x');
  9. test('x', () => {
  10. expect(x1).toBe(x2); // fails! They are both instances of `./__mocks__/x`, but not referentially equal
  11. });
  12. ```
  13. ### Rule details
  14. This rule reports imports from a path containing a `__mocks__` component.
  15. Example violations:
  16. ```js
  17. import thing from './__mocks__/index';
  18. require('./__mocks__/index');
  19. require('__mocks__');
  20. ```