新增: - backend/venv/ - Python 虚拟环境 - backend/start.sh - 启动脚本(使用虚拟环境) - backend/requirements.txt - 依赖列表 - .gitignore - 忽略虚拟环境和缓存文件 说明: - 每个项目使用独立虚拟环境 - 避免依赖冲突 - 启动脚本自动创建和激活虚拟环境
731 B
731 B
Disallow manually importing from __mocks__ (no-mocks-import)
When using jest.mock, your tests (just like the code being tested) should
import from ./x, not ./__mocks__/x. Not following this rule can lead to
confusion, because you will have multiple instances of the mocked module:
jest.mock('./x');
const x1 = require('./x');
const x2 = require('./__mocks__/x');
test('x', () => {
expect(x1).toBe(x2); // fails! They are both instances of `./__mocks__/x`, but not referentially equal
});
Rule details
This rule reports imports from a path containing a __mocks__ component.
Example violations:
import thing from './__mocks__/index';
require('./__mocks__/index');
require('__mocks__');