新增: - backend/venv/ - Python 虚拟环境 - backend/start.sh - 启动脚本(使用虚拟环境) - backend/requirements.txt - 依赖列表 - .gitignore - 忽略虚拟环境和缓存文件 说明: - 每个项目使用独立虚拟环境 - 避免依赖冲突 - 启动脚本自动创建和激活虚拟环境
1.4 KiB
1.4 KiB
Enforce valid describe() callback (valid-describe-callback)
Using an improper describe() callback function can lead to unexpected test
errors.
Rule Details
This rule validates that the second parameter of a describe() function is a
callback function. This callback function:
- should not be async
- should not contain any parameters
- should not contain any
returnstatements
The following describe function aliases are also validated:
describedescribe.onlydescribe.skipfdescribexdescribe
The following patterns are considered warnings:
// Async callback functions are not allowed
describe('myFunction()', async () => {
// ...
});
// Callback function parameters are not allowed
describe('myFunction()', done => {
// ...
});
//
describe('myFunction', () => {
// No return statements are allowed in block of a callback function
return Promise.resolve().then(() => {
it('breaks', () => {
throw new Error('Fail');
});
});
});
// Returning a value from a describe block is not allowed
describe('myFunction', () =>
it('returns a truthy value', () => {
expect(myFunction()).toBeTruthy();
}));
The following patterns are not considered warnings:
describe('myFunction()', () => {
it('returns a truthy value', () => {
expect(myFunction()).toBeTruthy();
});
});