Skip to content

Commit

Permalink
Apply WebStorm formatting, see phetsims/phet-info#155
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Feb 26, 2021
1 parent 2345da8 commit 20f1968
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 28 deletions.
4 changes: 2 additions & 2 deletions js/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

'use strict';

(() => {
( () => {
const aquaOptions = QueryStringMachine.getAll( {
testInfo: {
type: 'string',
Expand Down Expand Up @@ -151,4 +151,4 @@
console.log( '[NEXT TEST]' );
}
};
})();
} )();
4 changes: 2 additions & 2 deletions js/client/no-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

'use strict';

(() => {
( () => {
const options = QueryStringMachine.getAll( {
duration: {
type: 'number',
Expand All @@ -19,4 +19,4 @@
setTimeout( function() {
aqua.nextTest();
}, options.duration );
})();
} )();
4 changes: 2 additions & 2 deletions js/client/pageload-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

'use strict';

(() => {
( () => {
const options = QueryStringMachine.getAll( {
url: {
type: 'string',
Expand Down Expand Up @@ -45,4 +45,4 @@
aqua.simpleFail( data.message + '\n' + data.stack );
}
} );
})();
} )();
4 changes: 2 additions & 2 deletions js/client/qunit-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

'use strict';

(() => {
( () => {
const options = QueryStringMachine.getAll( {
url: {
type: 'string',
Expand Down Expand Up @@ -81,4 +81,4 @@
}
}
} );
})();
} )();
4 changes: 2 additions & 2 deletions js/client/sim-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

'use strict';

(() => {
( () => {
const options = QueryStringMachine.getAll( {
url: {
type: 'string',
Expand Down Expand Up @@ -80,4 +80,4 @@
}
}
} );
})();
} )();
4 changes: 2 additions & 2 deletions js/client/wrapper-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

'use strict';

(() => {
( () => {
const options = QueryStringMachine.getAll( {
url: {
type: 'string',
Expand Down Expand Up @@ -73,4 +73,4 @@
}
}
} );
})();
} )();
18 changes: 9 additions & 9 deletions js/server/ContinuousServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class ContinuousServer {
try {
this.loadFromFile();
}
catch ( e ) {
catch( e ) {
this.setError( `error loading from file: ${e}` );
}
}
Expand Down Expand Up @@ -161,7 +161,7 @@ class ContinuousServer {
res.end( this.reportJSON );
}
}
catch ( e ) {
catch( e ) {
this.setError( `server error: ${e}` );
}
} ).listen( port );
Expand Down Expand Up @@ -555,7 +555,7 @@ class ContinuousServer {
}
}
}
catch ( e ) {
catch( e ) {
this.setError( `snapshot error: ${e}` );
}
}
Expand Down Expand Up @@ -596,7 +596,7 @@ class ContinuousServer {

ContinuousServer.testPass( test, Date.now() - startTimestamp, output );
}
catch ( e ) {
catch( e ) {
ContinuousServer.testFail( test, Date.now() - startTimestamp, `Lint failed with status code ${e.code}:\n${e.stdout}\n${e.stderr}`.trim() );
}
this.saveToFile();
Expand All @@ -609,7 +609,7 @@ class ContinuousServer {

ContinuousServer.testPass( test, Date.now() - startTimestamp, output );
}
catch ( e ) {
catch( e ) {
ContinuousServer.testFail( test, Date.now() - startTimestamp, `Lint-everything failed with status code ${e.code}:\n${e.stdout}\n${e.stderr}`.trim() );
}
this.saveToFile();
Expand All @@ -623,7 +623,7 @@ class ContinuousServer {
ContinuousServer.testPass( test, Date.now() - startTimestamp, output );
test.success = true;
}
catch ( e ) {
catch( e ) {
ContinuousServer.testFail( test, Date.now() - startTimestamp, `Build failed with status code ${e.code}:\n${e.stdout}\n${e.stderr}`.trim() );
}
this.saveToFile();
Expand All @@ -633,7 +633,7 @@ class ContinuousServer {
await sleep( 1000 );
}
}
catch ( e ) {
catch( e ) {
this.setError( `local error: ${e}` );
}
}
Expand All @@ -648,7 +648,7 @@ class ContinuousServer {
try {
this.computeRecentTestWeights();
}
catch ( e ) {
catch( e ) {
this.setError( `weights error: ${e} ${e.stack}` );
}

Expand Down Expand Up @@ -739,7 +739,7 @@ class ContinuousServer {

this.reportJSON = JSON.stringify( report );
}
catch ( e ) {
catch( e ) {
this.setError( `report error: ${e}` );
}

Expand Down
2 changes: 1 addition & 1 deletion js/server/Snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class Snapshot {
lastRunnableTimestamps[ repo ] = timestamp;
}
}
catch ( e ) {
catch( e ) {
winston.error( `Could not read dependencies of repo ${repo}: ${e}` );
}
}
Expand Down
16 changes: 11 additions & 5 deletions js/snapshot-comparison.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

'use strict';

(function() {
( function() {
const req = new XMLHttpRequest();
req.onload = function() {
const simListText = req.responseText;
Expand All @@ -20,7 +20,7 @@
// location of active sims
req.open( 'GET', '../../perennial/data/active-runnables', true );
req.send();
})();
} )();

function setup( simNames ) {
const snapshots = [];
Expand Down Expand Up @@ -69,9 +69,11 @@ function setup( simNames ) {
context.drawImage( image, 0, 0 );
return context;
}

function contextToData( context ) {
return context.getImageData( 0, 0, options.simWidth, options.simHeight );
}

function dataToCanvas( data ) {
const canvas = document.createElement( 'canvas' );
const context = canvas.getContext( '2d' );
Expand All @@ -80,6 +82,7 @@ function setup( simNames ) {
context.putImageData( data, 0, 0 );
return canvas;
}

function compare( imageA, imageB, msg ) {
const threshold = 0;

Expand Down Expand Up @@ -108,10 +111,10 @@ function setup( simNames ) {

totalDifference += alphaMultipliedDiff;
// if ( alphaMultipliedDiff > threshold ) {
// console.log( message + ': ' + Math.abs( a.data[i] - b.data[i] ) );
// console.log( message + ': ' + Math.abs( a.data[i] - b.data[i] ) );
largestDifference = Math.max( largestDifference, alphaMultipliedDiff );
// isEqual = false;
// break;
// isEqual = false;
// break;
// }
}

Expand Down Expand Up @@ -172,6 +175,7 @@ function setup( simNames ) {
};
iframe.src = 'take-snapshot.html?' + childQueryParams + '&url=' + encodeURIComponent( '../../' + sim + '/' + sim + '_en.html' );
}

function nextSim() {
if ( queue.length ) {
loadSim( queue.shift() );
Expand Down Expand Up @@ -216,6 +220,7 @@ function setup( simNames ) {
const oldScreenshots = snapshots[ snapshots.indexOf( snapshot ) - 1 ][ sim ].screenshots;

let nextIndex = 0;

function run() {
const index = nextIndex++;
if ( index < newScreenshots.length && index < oldScreenshots.length ) {
Expand All @@ -231,6 +236,7 @@ function setup( simNames ) {
newImage.src = newScreenshots[ index ].url;
}
}

run();
} );
}
Expand Down
3 changes: 2 additions & 1 deletion js/take-snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ window.addEventListener( 'message', function( evt ) {
console.log( 'loaded' );
sendStep( 0.016 );
loaded = true;
} else if (data.type === 'error' ) {
}
else if ( data.type === 'error' ) {
window.parent && window.parent.postMessage( evt.data );
}
} );

0 comments on commit 20f1968

Please sign in to comment.