()
| 5 | console.log("\n=== Checking Console Test Results ===\n"); |
| 6 | |
| 7 | function checkTestResults() { |
| 8 | try { |
| 9 | console.log("Getting logcat output for test results..."); |
| 10 | |
| 11 | // Get only recent logcat entries and filter for JS entries to reduce output size |
| 12 | // Also include "{N} Runtime Tests" tag for Jasmine output |
| 13 | // Use a larger window to capture all failure details |
| 14 | const logcatOutput = execSync( |
| 15 | 'adb -e logcat -d -s JS -s "{N} Runtime Tests"', |
| 16 | { |
| 17 | encoding: "utf8", |
| 18 | maxBuffer: 4 * 1024 * 1024, // 4MB buffer limit for comprehensive logs |
| 19 | } |
| 20 | ); |
| 21 | |
| 22 | console.log("\n=== Analyzing Test Results ===\n"); |
| 23 | |
| 24 | // Track different types of test results |
| 25 | const testResults = { |
| 26 | esModules: { |
| 27 | status: "unknown", |
| 28 | total: 0, |
| 29 | passedCount: 0, |
| 30 | failedCount: 0, |
| 31 | detailMessages: [], |
| 32 | }, |
| 33 | jasmine: { specs: 0, failures: 0 }, |
| 34 | manual: { tests: [], failures: [] }, |
| 35 | general: { passes: 0, failures: 0 }, |
| 36 | }; |
| 37 | |
| 38 | // Look for ES Module test results (use the latest summary block) |
| 39 | const esModuleMatches = Array.from( |
| 40 | logcatOutput.matchAll( |
| 41 | /=== ES MODULE TEST RESULTS ===([\s\S]*?)(?=\n===|$)/g |
| 42 | ) |
| 43 | ); |
| 44 | if (esModuleMatches.length > 0) { |
| 45 | const lastMatch = esModuleMatches[esModuleMatches.length - 1]; |
| 46 | const blockText = lastMatch[1]; |
| 47 | |
| 48 | const passedMatch = blockText.match(/Tests passed:\s*(\d+)/); |
| 49 | const failedMatch = blockText.match(/Tests failed:\s*(\d+)/); |
| 50 | const totalMatch = blockText.match(/Total tests:\s*(\d+)/); |
| 51 | const statusMatch = blockText.match( |
| 52 | /(ALL ES MODULE TESTS PASSED!|SOME ES MODULE TESTS FAILED!)/ |
| 53 | ); |
| 54 | |
| 55 | if (passedMatch) |
| 56 | testResults.esModules.passedCount = parseInt(passedMatch[1], 10); |
| 57 | if (failedMatch) |
| 58 | testResults.esModules.failedCount = parseInt(failedMatch[1], 10); |
| 59 | if (totalMatch) testResults.esModules.total = parseInt(totalMatch[1], 10); |
| 60 | |
| 61 | if (statusMatch) { |
| 62 | testResults.esModules.status = statusMatch[1].includes("SOME") |
| 63 | ? "failed" |
| 64 | : "passed"; |
no test coverage detected