Skip to content

Commit

Permalink
✅ fix test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
whonion committed Dec 23, 2023
1 parent bb2d728 commit 3c1549f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { spawn } from 'child_process';

const MAX_TEST_DURATION_MS = 120000; // Test duration in milliseconds (e.g., 120 seconds)
const MAX_TEST_DURATION_MS = 60000; // Test duration in milliseconds (e.g., 120 seconds)
const SCRIPT_FILE = 'main.ts'; // Change this to match your main.ts filename

// Function to run the main.ts script for a specific duration
Expand All @@ -28,11 +28,15 @@ function runMainScriptForDuration() {
}

// Run the test
runMainScriptForDuration()
.then(() => {
(async () => {
try {
await runMainScriptForDuration();
console.log('Test completed successfully.');
})
.catch((error) => {
console.error('Test failed:', error);
process.exit(1); // Terminate with a non-zero exit code to indicate failure
});
} catch (error:any) {
if (error.message === 'The operation was canceled.') {
console.log('Test was canceled due to timeout.');
} else {
console.error('Test failed:', error);
}
}
})();

0 comments on commit 3c1549f

Please sign in to comment.