[ospec] Make the specTimeout tests hopefully less flaky
This commit is contained in:
parent
aa0f9eae98
commit
4a4377e553
1 changed files with 32 additions and 30 deletions
|
|
@ -401,38 +401,22 @@ o.spec("ospec", function() {
|
|||
done()
|
||||
})
|
||||
})
|
||||
o("scoped when nested", function(done) {
|
||||
o("The parent and sibling suites are not affected by the specTimeout", function(done) {
|
||||
var oo = o.new()
|
||||
var t
|
||||
|
||||
oo.specTimeout(10)
|
||||
oo.specTimeout(50)
|
||||
oo.beforeEach(function () {
|
||||
t = new Date
|
||||
})
|
||||
oo.afterEach(function () {
|
||||
var diff = new Date - t
|
||||
o(diff >= 10).equals(true)
|
||||
o(diff < 200).equals(true)
|
||||
o(diff >= 50).equals(true)
|
||||
o(diff < 80).equals(true)
|
||||
})
|
||||
|
||||
oo.spec("nested 1", function () {
|
||||
var t
|
||||
|
||||
oo.specTimeout(30)
|
||||
oo.beforeEach(function () {
|
||||
t = new Date
|
||||
})
|
||||
oo.afterEach(function () {
|
||||
var diff = new Date - t
|
||||
o(diff >= 30).equals(true)
|
||||
o(diff < 200).equals(true)
|
||||
})
|
||||
|
||||
oo("", function() {
|
||||
oo(true).equals(true)
|
||||
|
||||
return {then: function() {}}
|
||||
})
|
||||
oo.specTimeout(80)
|
||||
})
|
||||
|
||||
oo("", function() {
|
||||
|
|
@ -440,19 +424,40 @@ o.spec("ospec", function() {
|
|||
|
||||
return {then: function() {}}
|
||||
})
|
||||
|
||||
oo.spec("nested 2", function () {
|
||||
oo.specTimeout(80)
|
||||
})
|
||||
oo.spec("nested 3", function () {
|
||||
oo("", function() {
|
||||
oo(true).equals(true)
|
||||
|
||||
return {then: function() {}}
|
||||
})
|
||||
})
|
||||
oo.run(function(results) {
|
||||
o(results.length).equals(4)
|
||||
o(results[0].pass).equals(true)
|
||||
o(results[1].pass).equals(false)
|
||||
o(results[2].pass).equals(true)
|
||||
o(results[3].pass).equals(false)
|
||||
done()
|
||||
})
|
||||
})
|
||||
o("nested suites inherit the specTimeout", function(done) {
|
||||
var oo = o.new()
|
||||
|
||||
oo.specTimeout(50)
|
||||
oo.spec("nested", function () {
|
||||
oo.spec("deeply", function() {
|
||||
var t
|
||||
|
||||
oo.specTimeout(20)
|
||||
oo.beforeEach(function () {
|
||||
t = new Date
|
||||
})
|
||||
oo.afterEach(function () {
|
||||
var diff = new Date - t
|
||||
o(diff >= 20).equals(true)
|
||||
o(diff < 200).equals(true)
|
||||
o(diff >= 50).equals(true)
|
||||
o(diff < 80).equals(true)
|
||||
})
|
||||
|
||||
oo("", function() {
|
||||
|
|
@ -463,17 +468,14 @@ o.spec("ospec", function() {
|
|||
})
|
||||
})
|
||||
oo.run(function(results) {
|
||||
o(results.length).equals(6)
|
||||
o(results.length).equals(2)
|
||||
o(results[0].pass).equals(true)
|
||||
o(results[1].pass).equals(false)
|
||||
o(results[2].pass).equals(true)
|
||||
o(results[3].pass).equals(false)
|
||||
o(results[4].pass).equals(true)
|
||||
o(results[5].pass).equals(false)
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
o.spec("calling done() twice throws", function () {
|
||||
o("two successes", function(done) {
|
||||
var oo = o.new()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue