typescript 茉莉花中的 xdescribe 与 fdescribe
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48740288/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
xdescribe vs fdescribe in jasmine
提问by Ramesh Rajendran
fdescribe
- Execute if the spec.ts file is defined withfdescribed
xdescribe
- Never execute if spec.ts file is defined withxdescribed
fdescribe
- 如果 spec.ts 文件定义为,则执行fdescribed
xdescribe
- 如果 spec.ts 文件定义为,则永远不要执行xdescribed
Is my understand is correct? and what about if am defined both xdescribe
and fdescribe
in two separate spec.ts
file?
我的理解是否正确?大约上午是否定义都什么xdescribe
和fdescribe
在两个单独的spec.ts
文件?
回答by Aravind
xdescribe
will eXcludethose specs from execution.fdescribe
will first executethose specs. if you have both the fdescribe specs will be executed and reset is ignored
xdescribe
将排除与由执行这些规范。fdescribe
将首先执行这些规范。如果您同时拥有 fdescribe 规范,则将执行并忽略重置
回答by deerawan
fdescribe
- focuseddescribe. If it exists, jasmine will run onlyfdescribe
spec and ignore other type of describe (describe
andxdescribe
).xdescribe
- disableddescribe. It will neverbe executed.
fdescribe
-重点描述。如果存在,jasmine将只运行fdescribe
spec 并忽略其他类型的 describe (describe
和xdescribe
)。xdescribe
-禁用描述。它永远不会被执行。
Some scenarios to gain more understanding:
一些场景以获得更多理解:
Scenario 1 - describe
only
场景 1 -describe
仅
describe('test1', ..)
describe('test2', ..)
describe('test3', ..)
// Specs executed:
// test1
// test2
// test3
Scenario 2 - single fdescribe
场景 2 - 单人 fdescribe
fdescribe('test1', ..)
describe('test2', ..)
describe('test3', ..)
// Specs executed:
// test1
Scenario 3 - multiple fdescribe
场景 3 - 多个 fdescribe
fdescribe('test1', ..)
fdescribe('test2', ..)
describe('test3', ..)
// Specs executed:
// test1
// test2
Scenario 4 - single xdescribe
场景 4 - 单人 xdescribe
xdescribe('test1', ..)
describe('test2', ..)
describe('test3', ..)
// Specs executed:
// test2
// test3
Scenario 4 - multiple xdescribe
场景 4 - 多个 xdescribe
xdescribe('test1', ..)
xdescribe('test2', ..)
describe('test3', ..)
// Specs executed:
// test3
Scenario 5 - fdescribe
and xdescribe
exists
场景 5 -fdescribe
并且xdescribe
存在
fdescribe('test1', ..)
xdescribe('test2', ..)
describe('test3', ..)
// Specs executed:
// test1
Beside those two, Jasmine also has fit
and xit
with same rules.
除了这两个,茉莉花还有fit
和xit
一样的规则。
Interestingly, Jasmine 3 will show an error when running the test if fdescribe
spec exists to prevent users from inadvertently disabled other specs.
有趣的是,如果fdescribe
规范存在,Jasmine 3 会在运行测试时显示错误,以防止用户无意中禁用其他规范。
The error message:
错误信息:
Incomplete: fit() or fdescribe() was found
Reference:
参考: