@@ -10,12 +10,17 @@ import {
1010 setupTestEnvironment ,
1111} from "./fixtures" ;
1212
13+ // Set global timeout for all tests in this suite
14+ jest . setTimeout ( 40 * 1000 ) ; // 40 seconds
15+
1316// Helper function to run CLI commands with TypeScript
1417async function runCli (
1518 args : string [ ] ,
1619) : Promise < { stdout : string ; stderr : string ; exitCode : number } > {
1720 return new Promise ( ( resolve ) => {
1821 const packageRoot = path . resolve ( __dirname , "../../../" ) ;
22+ // NB: cli.js must be compiled before running this test
23+ // This is fine in CI, since we compile before running tests
1924 const cliPath = path . join ( packageRoot , "dist/cli.js" ) ;
2025
2126 // Use spawn to avoid shell interpretation issues
@@ -49,15 +54,12 @@ describe("CLI Integration Tests", () => {
4954 let syncableFiles : any [ ] = [ ] ;
5055
5156 beforeAll ( async ( ) => {
52- // Increase timeout for setup operations
53- jest . setTimeout ( 40000 ) ; // 40 seconds
54-
5557 // Set up test environment
5658 testSetup = await setupTestEnvironment ( "cli_test" ) ;
5759
5860 // Create test files in Humanloop for syncing
5961 syncableFiles = await createSyncableFilesFixture ( testSetup ) ;
60- } , 30000 ) ;
62+ } ) ;
6163
6264 afterAll ( async ( ) => {
6365 await cleanupTestEnvironment (
@@ -67,25 +69,25 @@ describe("CLI Integration Tests", () => {
6769 id : file . id as string ,
6870 } ) ) ,
6971 ) ;
70- } , 30000 ) ;
72+ } ) ;
7173
7274 /**
7375 * NOTE: This test is currently skipped due to issues with CLI environment isolation.
74- *
75- * The test attempts to verify behavior when no API key is available, but faces
76+ *
77+ * The test attempts to verify behavior when no API key is available, but faces
7678 * challenges with how Node.js handles process execution during tests:
77- *
78- * 1. When executed via child_process.exec, the path to nonexistent env files
79+ *
80+ * 1. When executed via child_process.exec, the path to nonexistent env files
7981 * causes Node to return exit code 9 (SIGKILL) instead of the expected code 1
8082 * 2. Shell interpretation of arguments makes it difficult to reliably test this edge case
81- *
83+ *
8284 * If this functionality needs testing, consider:
8385 * - Using child_process.spawn for better argument handling
8486 * - Unit testing the API key validation logic directly
8587 * - Moving this test to a separate process with full environment isolation
86- *
88+ *
8789 * @see https://nodejs.org/api/child_process.html for more info on process execution
88- */
90+ */
8991 test . skip ( "pull_without_api_key: should show error when no API key is available" , async ( ) => {
9092 // GIVEN a temporary directory and no API key
9193 const { tempDir, cleanup } = createTempDir ( "cli-no-api-key" ) ;
@@ -118,9 +120,6 @@ describe("CLI Integration Tests", () => {
118120 } ) ;
119121
120122 test ( "pull_basic: should pull all files successfully" , async ( ) => {
121- // Increase timeout for this test
122- jest . setTimeout ( 30000 ) ; // 30 seconds
123-
124123 // GIVEN a base directory for pulled files
125124 const { tempDir, cleanup } = createTempDir ( "cli-basic-pull" ) ;
126125
@@ -152,7 +151,7 @@ describe("CLI Integration Tests", () => {
152151 }
153152
154153 cleanup ( ) ;
155- } , 30000 ) ;
154+ } ) ;
156155
157156 test ( "pull_with_specific_path: should pull files from a specific path" , async ( ) => {
158157 // GIVEN a base directory and specific path
@@ -193,9 +192,6 @@ describe("CLI Integration Tests", () => {
193192 } ) ;
194193
195194 test ( "pull_with_environment: should pull files from a specific environment" , async ( ) => {
196- // Increase timeout for this test
197- jest . setTimeout ( 30000 ) ; // 30 seconds
198-
199195 // GIVEN a base directory and environment
200196 const { tempDir, cleanup } = createTempDir ( "cli-env-pull" ) ;
201197
@@ -216,7 +212,7 @@ describe("CLI Integration Tests", () => {
216212 expect ( result . stdout ) . toContain ( "Environment: staging" ) ;
217213
218214 cleanup ( ) ;
219- } , 30000 ) ;
215+ } ) ;
220216
221217 test ( "pull_with_quiet_mode: should pull files with quiet mode enabled" , async ( ) => {
222218 // GIVEN a base directory and quiet mode
0 commit comments