@@ -148,7 +148,7 @@ <h3>Test Details:</h3>
148148
149149 // Download test files
150150 addToOutput ( "\n2. Downloading test files..." ) ;
151- await pyodide . runPython ( `
151+ const downloadsResult = await pyodide . runPython ( `
152152 import pathlib
153153 from pyodide.http import open_url
154154
@@ -168,25 +168,32 @@ <h3>Test Details:</h3>
168168 config_content = '{"pokemon_name": "pikachu"}'
169169 pathlib.Path("config.json").write_text(config_content)
170170 print("✓ Created config.json")
171+
172+ "All files downloaded and created successfully!"
171173 ` ) ;
174+ addToOutput ( downloadsResult ) ;
172175
173176 // Test CDK CLI functionality
174- addToOutput ( "\n3. Testing CDK CLI functionality..." ) ;
175- const cliResult = await pyodide . runPython ( `
177+ addToOutput ( "\n3. Testing 'spec' functionality..." ) ;
178+ const specResult = await pyodide . runPython ( `
176179 import sys
177180 from io import StringIO
178181 from airbyte_cdk.cli.source_declarative_manifest import run
179182
180- # # Capture stdout
181- # old_stdout = sys.stdout
182- # sys.stdout = captured_output = StringIO()
183-
184183 try:
185184 # Test the CLI with a simple command first
186185 print("Testing 'spec' command...", file=sys.stderr)
186+ # Capture both stdout and stderr
187+ old_stdout = sys.stdout
188+ old_stderr = sys.stderr
189+ captured_stdout = StringIO()
190+ captured_stderr = StringIO()
191+
192+ sys.stdout = captured_stdout
193+ sys.stderr = captured_stderr
187194
188195 args = [
189- "read ",
196+ "spec ",
190197 "--manifest-path",
191198 "manifest.yaml",
192199 "--config",
@@ -204,35 +211,62 @@ <h3>Test Details:</h3>
204211 result = f"✗ CLI execution failed: {str(e)}"
205212 import traceback
206213 result += f"\\nTraceback: {traceback.format_exc()}"
214+ finally:
215+ # Get captured output
216+ stdout_content = captured_stdout.getvalue()
217+ stderr_content = captured_stderr.getvalue()
218+
219+ result = "✓ CLI executed successfully\\n"
220+ if stdout_content:
221+ result += f"STDOUT:\\n{stdout_content}\\n"
222+ if stderr_content:
223+ result += f"STDERR:\\n{stderr_content}\\n"
224+
225+ # Restore original stdout/stderr
226+ sys.stdout = old_stdout
227+ sys.stderr = old_stderr
207228
208229 result
209230 ` ) ;
210- addToOutput ( cliResult ) ;
231+ addToOutput ( specResult ) ;
211232
212- // Final verification
213- addToOutput ( "\n4. Final verification..." ) ;
214- const finalCheck = pyodide . runPython ( `
215- # Verify the WASM compatibility is working
233+ addToOutput ( "\n4. Testing 'read' functionality..." ) ;
234+ const readResult = await pyodide . runPython ( `
216235 import sys
236+ from io import StringIO
237+ from airbyte_cdk.cli.source_declarative_manifest import run
217238
218- success_criteria = []
219-
220- # Check platform detection
221- if sys.platform == 'emscripten':
222- success_criteria.append("✓ Platform correctly detected as 'emscripten'")
223- else:
224- success_criteria.append(f"? Platform detected as '{sys.platform}' (may be expected in some WASM environments)")
239+ # # Capture stdout
240+ # old_stdout = sys.stdout
241+ # sys.stdout = captured_output = StringIO()
225242
226- # Check CDK imports work
227243 try:
228- from airbyte_cdk.models.airbyte_protocol_serializers import Serializer
229- success_criteria.append("✓ CDK serializers import successfully")
230- except ImportError as e:
231- success_criteria.append(f"✗ CDK serializers import failed: {e}")
244+ # Test the CLI with a simple command first
245+ print("Testing 'spec' command...", file=sys.stderr)
232246
233- "\\n".join(success_criteria)
247+ args = [
248+ "read",
249+ "--manifest-path",
250+ "manifest.yaml",
251+ "--config",
252+ "config.json",
253+ "--catalog",
254+ "catalog.json",
255+ ]
256+
257+ # Run the CLI
258+ run(args)
259+
260+ result = "✓ CLI executed successfully"
261+
262+ except Exception as e:
263+ result = f"✗ CLI execution failed: {str(e)}"
264+ import traceback
265+ result += f"\\nTraceback: {traceback.format_exc()}"
266+
267+ result
234268 ` ) ;
235- addToOutput ( finalCheck ) ;
269+ addToOutput ( readResult ) ;
236270
237271 addToOutput ( "\n" + "=" . repeat ( 50 ) ) ;
238272 addToOutput ( "WASM compatibility test completed!" ) ;
0 commit comments