mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
bafdf8d9f2
Update all tests for `no-var` and `prefer-arrow-callback` (using `--fix`)
37 lines
1 KiB
JavaScript
37 lines
1 KiB
JavaScript
const path = require('path');
|
|
const test = require('tap').test;
|
|
const attachTestStorage = require('../fixtures/attach-test-storage');
|
|
const extract = require('../fixtures/extract');
|
|
const VirtualMachine = require('../../src/index');
|
|
|
|
const uri = path.resolve(__dirname, '../fixtures/data.sb2');
|
|
const project = extract(uri);
|
|
|
|
test('data', t => {
|
|
const vm = new VirtualMachine();
|
|
attachTestStorage(vm);
|
|
|
|
// Evaluate playground data and exit
|
|
vm.on('playgroundData', () => {
|
|
// @todo Additional tests
|
|
t.end();
|
|
process.nextTick(process.exit);
|
|
});
|
|
|
|
// Start VM, load project, and run
|
|
t.doesNotThrow(() => {
|
|
vm.start();
|
|
vm.clear();
|
|
vm.setCompatibilityMode(false);
|
|
vm.setTurboMode(false);
|
|
vm.loadProject(project).then(() => {
|
|
vm.greenFlag();
|
|
|
|
// After two seconds, get playground data and stop
|
|
setTimeout(() => {
|
|
vm.getPlaygroundData();
|
|
vm.stopAll();
|
|
}, 2000);
|
|
});
|
|
});
|
|
});
|