mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
0fcc248ac1
The tests run using TinyWorker, which emulates web workers on Node. There are quite a few quirks in that situation due to the differences between Node and Webpack as well as the differences between TinyWorker and real Web Workers. The tests also exposed a few bugs in the dispatch system, which have now been fixed. Most notably, if a method called through the dispatch system throws an exception that exception will now be passed back to the caller. Previously the exception would escape the dispatch system and the caller would never hear any response at all.
20 lines
373 B
JavaScript
20 lines
373 B
JavaScript
class DispatchTestService {
|
|
returnFortyTwo () {
|
|
return 42;
|
|
}
|
|
|
|
doubleArgument (x) {
|
|
return 2 * x;
|
|
}
|
|
|
|
throwException () {
|
|
throw new Error('This is a test exception thrown by LocalDispatchTest');
|
|
}
|
|
|
|
close () {
|
|
// eslint-disable-next-line no-undef
|
|
self.close();
|
|
}
|
|
}
|
|
|
|
module.exports = DispatchTestService;
|