mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-28 22:30:40 -04:00
support execute integration tests with monitor threads
Do not count monitor threads towards the "active" number of threads. The test is complete when there are no non-monitor threads running.
This commit is contained in:
parent
c76ad21093
commit
18c565794e
1 changed files with 8 additions and 1 deletions
|
@ -31,7 +31,14 @@ const whenThreadsComplete = (t, vm, timeLimit = 2000) => (
|
|||
// When the number of threads reaches 0 the test is expected to be complete.
|
||||
new Promise((resolve, reject) => {
|
||||
const intervalId = setInterval(() => {
|
||||
if (vm.runtime.threads.length === 0) {
|
||||
let active = 0;
|
||||
const threads = vm.runtime.threads;
|
||||
for (let i = 0; i < threads.length; i++) {
|
||||
if (!threads[i].updateMonitor) {
|
||||
active += 1;
|
||||
}
|
||||
}
|
||||
if (active === 0) {
|
||||
resolve();
|
||||
}
|
||||
}, 50);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue