MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

update run.js for spec

+20 -8
+20 -8
examples/spec/run.js
··· 15 15 .filter(f => f.endsWith('.js') && f !== 'run.js' && f !== 'helpers.js') 16 16 .sort(); 17 17 18 - let passed = 0; 19 - let failed = 0; 18 + let totalPassed = 0; 19 + let totalFailed = 0; 20 + 21 + let filesPassed = 0; 22 + let filesFailed = 0; 20 23 21 24 console.log(`\n${BOLD}${CYAN}Running ${files.length} spec files...${RESET}\n`); 22 25 ··· 26 29 27 30 try { 28 31 const result = await $`./build/ant ${filePath}`; 29 - console.log(result.text()); 32 + const output = result.text(); 33 + console.log(output); 34 + 35 + const passedMatch = output.match(/Passed:\s*(\d+)/); 36 + const failedMatch = output.match(/Failed:\s*(\d+)/); 37 + 38 + if (passedMatch) totalPassed += parseInt(passedMatch[1], 10); 39 + if (failedMatch) totalFailed += parseInt(failedMatch[1], 10); 30 40 31 41 if (result.exitCode === 0) { 32 42 console.log(`${GREEN}โœ“${RESET} ${name}`); 33 - passed++; 43 + filesPassed++; 34 44 } else { 35 45 console.log(`${RED}โœ—${RESET} ${name}`); 36 - failed++; 46 + filesFailed++; 37 47 } 38 48 } catch (e) { 39 49 console.log(`${RED}โœ—${RESET} ${name} ${DIM}(error)${RESET}`); 40 - failed++; 50 + filesFailed++; 41 51 } 42 52 } 43 53 44 54 console.log(`\n${BOLD}Results:${RESET}`); 45 - console.log(` ${GREEN}${passed} passed${RESET}`); 46 - console.log(` ${RED}${failed} failed${RESET}\n`); 55 + console.log(` ${GREEN}${totalPassed} tests passed${RESET}`); 56 + console.log(` ${RED}${totalFailed} tests failed${RESET}`); 57 + console.log(` ${GREEN}${filesPassed} files passed${RESET}`); 58 + console.log(` ${RED}${filesFailed} files failed${RESET}\n`); 47 59 48 60 process.exit(failed > 0 ? 1 : 0);