fdescribe
- Execute if the spec.ts file is defined with fdescribed
xdescribe
- Never execute if spec.ts file is defined with xdescribed
Is my understand is correct? and what about if am defined both xdescribe
and fdescribe
in two separate spec.ts
file?
xdescribe: FunctionLike describe , but instructs the test runner to exclude this group of test cases from execution. This is useful for debugging, or for excluding broken tests until they can be fixed. See http://jasmine.github.io/ for more details.
fdescribe: FunctionLike describe , but instructs the test runner to only run the test cases in this group. This is useful for debugging.
Jasmine is a behavior-driven development framework for testing JavaScript code that plays very well with Karma. Similar to Karma, it's also the recommended testing framework within the Angular documentation as it's setup for you with the Angular CLI. Jasmine is also dependency free and doesn't require a DOM.
fdescribe
- focused describe. If it exists, jasmine will run only fdescribe
spec and ignore other type of describe (describe
and xdescribe
). xdescribe
- disabled describe. It will never be executed. Some scenarios to gain more understanding:
Scenario 1 - describe
only
describe('test1', ..)
describe('test2', ..)
describe('test3', ..)
// Specs executed:
// test1
// test2
// test3
Scenario 2 - single fdescribe
fdescribe('test1', ..)
describe('test2', ..)
describe('test3', ..)
// Specs executed:
// test1
Scenario 3 - multiple fdescribe
fdescribe('test1', ..)
fdescribe('test2', ..)
describe('test3', ..)
// Specs executed:
// test1
// test2
Scenario 4 - single xdescribe
xdescribe('test1', ..)
describe('test2', ..)
describe('test3', ..)
// Specs executed:
// test2
// test3
Scenario 4 - multiple xdescribe
xdescribe('test1', ..)
xdescribe('test2', ..)
describe('test3', ..)
// Specs executed:
// test3
Scenario 5 - fdescribe
and xdescribe
exists
fdescribe('test1', ..)
xdescribe('test2', ..)
describe('test3', ..)
// Specs executed:
// test1
Beside those two, Jasmine also has fit
and xit
with same rules.
Interestingly, Jasmine 3 will show an error when running the test if fdescribe
spec exists to prevent users from inadvertently disabled other specs.
The error message:
Incomplete: fit() or fdescribe() was found
Reference:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With