![](/img/trans.png)
[英]Does after block still excecute if before or it block fail in mocha test
[英]can we write before & after block to a particular test case (it) of mocha
我可以在下面写些东西吗? 我可以像在describe块中那样在对特定测试用例之前声明方法吗?
describe('demo test suite', function(){
it('demo test case one', function(){.....})
it('demo test case two', function(done){
before(function(){
//Do some operation only for this particular test case
})
//Do some operation again
})
})
您的意图对我有点不清楚,但是您可以嵌套描述函数:
describe('demo test suite', function(){
it('demo test case one', function(){.....})
describe('demo test case two', function(done){
before(function(){
//Do some operation
})
it('....', function(){
//Do some operation again
})
})
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.