Skip to content

Commit

Permalink
Allow linting on non-Gruntfile repos, add timeout for npm run tasks, …
Browse files Browse the repository at this point in the history
…and added scenerystack to npm run supported repos, see #226, #230
  • Loading branch information
jonathanolson committed Jan 3, 2025
1 parent 49a387d commit c589986
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions js/server/ContinuousServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ const NPM_RUN_SUPPORTED = [
'perennial',
'perennial-alias',
'rosetta',
'yotta'
'yotta',
'scenerystack'
];

const minutesToMS = minutes => 1000 * 60 * minutes;
Expand Down Expand Up @@ -719,7 +720,7 @@ class ContinuousServer {
if ( test.type === 'lint' ) {
test.complete = true;
try {
const output = await execute( gruntCommand, [ 'lint', '--disable-eslint-cache' ], `${snapshot.directory}/${test.repo}` );
const output = await execute( gruntCommand, [ 'lint', `--repo=${test.repo}`, '--disable-eslint-cache' ], `${snapshot.directory}/perennial` );

ContinuousServer.testPass( test, Date.now() - startTimestamp, output );
}
Expand All @@ -731,7 +732,15 @@ class ContinuousServer {
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}` );

const executePromise = execute( npmCommand, [ 'run', ...test.testCommand.split( ' ' ) ], `${snapshot.directory}/${test.repo}` );
const timeoutPromise = ( async () => {
await sleep( 3600000 ); // 1 hour

throw new Error( 'npm run timeout' );
} )();

const output = await Promise.race( [ executePromise, timeoutPromise ] );

ContinuousServer.testPass( test, Date.now() - startTimestamp, output );
}
Expand Down

0 comments on commit c589986

Please sign in to comment.