runapptests - Set an initial value for the timeOffset

pull/3413/head
Martin Boonk 2024-05-13 18:00:46 +02:00
parent 409b8cbdfc
commit 107727ce6b
1 changed files with 3 additions and 2 deletions

View File

@ -311,11 +311,12 @@ function runStep(step, subtest, test, state){
break; break;
case "sleep" : case "sleep" :
p = p.then(()=>{ p = p.then(()=>{
console.log("> SLEEP FOR", step.ms); console.log("> SLEEP FOR", step.ms + "ms");
if (!subtest.wrappedDateNow){ if (!subtest.wrappedDateNow){
emu.tx(`Date.now = (o)=>{return ()=>{ emu.tx(`Date.now = (o)=>{return ()=>{
return o() + global.APPTESTS.timeOffset; return o() + global.APPTESTS.timeOffset;
};}(Date.now);\n`); };}(Date.now);
global.APPTESTS.timeOffset = 0;\n`);
subtest.wrappedDateNow = true; subtest.wrappedDateNow = true;
} }
emu.tx(`global.APPTESTS.timeOffset += ${step.ms}; emu.tx(`global.APPTESTS.timeOffset += ${step.ms};