Part of the motivation for this test is to verify compatibility with
Scratch 2.0 / SB2 behavior, so we shouldn't change the project to an SB3
file without very good reason.
Newer versions of `tap` run more asynchronously, so sometimes using `process.nextTick(process.exit)`
to end a test would prevent the test from completing correctly. Removing all instances of
`process.nextTick(process.exit)` put tests into three categories:
* the test still worked correctly -- no fixup needed.
* the test would hang because the VM's `_steppingInterval` was keeping
Node alive. These tests call a new `quit()` method which ends the
stepping interval.
* the `load-extensions` test needed special attention because the "Video
Sensing" extension starts its own loop using `setTimeout`. I added a
`_stopLoop()` method on the extension and directly call that from the
test. I'm not completely happy with this solution but anything more
general would likely require a change to the extension spec, so I'm
leaving that as a followup task.
Rather than assuming that the storage instance will be attached to a VM,
just return it. Callers may attach it to a `VM` or (in the case of
`import_sb2.js`) to a `Runtime`.
This new test verifies that clones and their associated threads are
cleaned up properly by the `delete this clone` block. The clones run two
stacks each: one which waits and then deletes the clone, and another
which includes a `forever` loop: this is to verify that the thread
running the `forever` loop is ended when the clone itself is deleted.
The project does this with two batches of clones to ensure there are no
problems with reusing array indices previously occupied by now-removed
threads or clones.