mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-07-10 04:54:04 -04:00
Use ES6 linting rules in the project root
Update all tests for `no-var` and `prefer-arrow-callback` (using `--fix`)
This commit is contained in:
parent
5f59d1e7e5
commit
bafdf8d9f2
36 changed files with 666 additions and 666 deletions
test/integration
|
@ -1,32 +1,32 @@
|
|||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var test = require('tap').test;
|
||||
var attachTestStorage = require('../fixtures/attach-test-storage');
|
||||
var extract = require('../fixtures/extract');
|
||||
var VirtualMachine = require('../../src/index');
|
||||
const fs = require('fs');
|
||||
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');
|
||||
|
||||
var projectUri = path.resolve(__dirname, '../fixtures/complex.sb2');
|
||||
var project = extract(projectUri);
|
||||
const projectUri = path.resolve(__dirname, '../fixtures/complex.sb2');
|
||||
const project = extract(projectUri);
|
||||
|
||||
var spriteUri = path.resolve(__dirname, '../fixtures/sprite.json');
|
||||
var sprite = fs.readFileSync(spriteUri, 'utf8');
|
||||
const spriteUri = path.resolve(__dirname, '../fixtures/sprite.json');
|
||||
const sprite = fs.readFileSync(spriteUri, 'utf8');
|
||||
|
||||
test('complex', function (t) {
|
||||
var vm = new VirtualMachine();
|
||||
test('complex', t => {
|
||||
const vm = new VirtualMachine();
|
||||
attachTestStorage(vm);
|
||||
|
||||
// Evaluate playground data and exit
|
||||
vm.on('playgroundData', function (e) {
|
||||
var threads = JSON.parse(e.threads);
|
||||
vm.on('playgroundData', e => {
|
||||
const threads = JSON.parse(e.threads);
|
||||
t.ok(threads.length === 0);
|
||||
t.end();
|
||||
process.nextTick(process.exit);
|
||||
});
|
||||
|
||||
// Manipulate each target
|
||||
vm.on('targetsUpdate', function (data) {
|
||||
var targets = data.targetList;
|
||||
for (var i in targets) {
|
||||
vm.on('targetsUpdate', data => {
|
||||
const targets = data.targetList;
|
||||
for (const i in targets) {
|
||||
if (targets[i].isStage === true) continue;
|
||||
if (targets[i].name.match(/test/)) continue;
|
||||
|
||||
|
@ -55,12 +55,12 @@ test('complex', function (t) {
|
|||
});
|
||||
|
||||
// Start VM, load project, and run
|
||||
t.doesNotThrow(function () {
|
||||
t.doesNotThrow(() => {
|
||||
vm.start();
|
||||
vm.clear();
|
||||
vm.setCompatibilityMode(false);
|
||||
vm.setTurboMode(false);
|
||||
vm.loadProject(project).then(function () {
|
||||
vm.loadProject(project).then(() => {
|
||||
vm.greenFlag();
|
||||
|
||||
// Post IO data
|
||||
|
@ -89,7 +89,7 @@ test('complex', function (t) {
|
|||
);
|
||||
|
||||
// After two seconds, get playground data and stop
|
||||
setTimeout(function () {
|
||||
setTimeout(() => {
|
||||
vm.getPlaygroundData();
|
||||
vm.stopAll();
|
||||
}, 2000);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue