UNPKG

siesta-lite

Version:

Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers

50 lines (37 loc) 1.16 kB
StartTest(function (topTest) { var delay = (time) => new Promise(resolve => setTimeout(resolve, time)) var log = [] topTest.testGeneric({ doNotTranslate : true }, function (t) { log.push('SpecRoot') t.beforeEach(function () { log.push('SpecRoot-beforeEach1') }) t.beforeEach(async t => { await delay(100) log.push('SpecRoot-beforeEach2') }) t.afterEach(function () { log.push('SpecRoot-afterEach') }) t.afterEach(async t => { await delay(100) log.push('SpecRoot-afterEach2') }) t.it("Root->Spec1", function (t) { log.push('Root->Spec1') }) }, function () { topTest.isDeeply(log, [ 'SpecRoot', 'SpecRoot-beforeEach1', 'SpecRoot-beforeEach2', 'Root->Spec1', 'SpecRoot-afterEach2', 'SpecRoot-afterEach', ], 'Correctly called all before/after actions' ) }) // eof testGeneric })