新增: - backend/venv/ - Python 虚拟环境 - backend/start.sh - 启动脚本(使用虚拟环境) - backend/requirements.txt - 依赖列表 - .gitignore - 忽略虚拟环境和缓存文件 说明: - 每个项目使用独立虚拟环境 - 避免依赖冲突 - 启动脚本自动创建和激活虚拟环境
47 lines
1.3 KiB
Markdown
47 lines
1.3 KiB
Markdown
# Disallow alias methods (`no-alias-methods`)
|
|
|
|
Several Jest methods have alias names, such as `toThrow` having the alias of
|
|
`toThrowError`. This rule ensures that only the canonical name as used in the
|
|
Jest documentation is used in the code. This makes it easier to search for all
|
|
occurrences of the method within code, and it ensures consistency among the
|
|
method names used.
|
|
|
|
## Rule details
|
|
|
|
This rule triggers a warning if the alias name, rather than the canonical name,
|
|
of a method is used.
|
|
|
|
### Default configuration
|
|
|
|
The following patterns are considered warnings:
|
|
|
|
```js
|
|
expect(a).toBeCalled();
|
|
expect(a).toBeCalledTimes();
|
|
expect(a).toBeCalledWith();
|
|
expect(a).lastCalledWith();
|
|
expect(a).nthCalledWith();
|
|
expect(a).toReturn();
|
|
expect(a).toReturnTimes();
|
|
expect(a).toReturnWith();
|
|
expect(a).lastReturnedWith();
|
|
expect(a).nthReturnedWith();
|
|
expect(a).toThrowError();
|
|
```
|
|
|
|
The following patterns are not considered warnings:
|
|
|
|
```js
|
|
expect(a).toHaveBeenCalled();
|
|
expect(a).toHaveBeenCalledTimes();
|
|
expect(a).toHaveBeenCalledWith();
|
|
expect(a).toHaveBeenLastCalledWith();
|
|
expect(a).toHaveBeenNthCalledWith();
|
|
expect(a).toHaveReturned();
|
|
expect(a).toHaveReturnedTimes();
|
|
expect(a).toHaveReturnedWith();
|
|
expect(a).toHaveLastReturnedWith();
|
|
expect(a).toHaveNthReturnedWith();
|
|
expect(a).toThrow();
|
|
```
|