Skip to content

Commit

Permalink
restrict usages of "npm run" tests, #223
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Nov 21, 2024
1 parent 1d1ff6e commit 11ad46c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion js/server/ContinuousServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ const linear = ( a1, a2, b1, b2, a3 ) => {
return ( b2 - b1 ) / ( a2 - a1 ) * ( a3 - a1 ) + b1;
};

// List of repos that are allowed to run tests with `npm run`
const NPM_RUN_SUPPORTED = [
'aqua',
'chipper',
'perennial',
'perennial-alias',
'rosetta',
'yotta'
];

// {number} - in milliseconds
const twoHours = 1000 * 60 * 60 * 2;
const twelveHours = 1000 * 60 * 60 * 12;
Expand Down Expand Up @@ -666,12 +676,13 @@ class ContinuousServer {
else if ( test.type === 'npm-run' ) {
test.complete = true;
try {
assert( NPM_RUN_SUPPORTED.includes( test.repo ), `Cannot test \`npm run\` in unsupported repo: ${test.repo}` );
const output = await execute( npmCommand, [ 'run', ...test.testCommand.split( ' ' ) ], `${snapshot.directory}/${test.repo}` );

ContinuousServer.testPass( test, Date.now() - startTimestamp, output );
}
catch( e ) {
ContinuousServer.testFail( test, Date.now() - startTimestamp, `Lint-everything failed with status code ${e.code}:\n${e.stdout}\n${e.stderr}`.trim() );
ContinuousServer.testFail( test, Date.now() - startTimestamp, `npm run failed with status code ${e.code}:\n${e.stdout}\n${e.stderr}`.trim() );
}
}
else if ( test.type === 'build' ) {
Expand Down

0 comments on commit 11ad46c

Please sign in to comment.