* Verifies that a TypeScript project compiles. * @param {string} name The name of the project. * @param {string} directory The project directory. * @returns {Promise }
(name, directory)
| 43 | * @returns {Promise<void>} |
| 44 | */ |
| 45 | async function verify(name, directory) { |
| 46 | let line = ` ${name}...`; |
| 47 | process.stdout.write(line); |
| 48 | |
| 49 | let diagnostics = await compile(path.join(directory, 'tsconfig.json')); |
| 50 | let success = diagnostics.length === 0; |
| 51 | let report = `\x1b${success ? '[32m✔' : '[31mX'}\x1b[0m`; |
| 52 | |
| 53 | if (process.stdout.isTTY) { |
| 54 | process.stdout.write(`\x1b[${line.length}D${report} ${name} \n`); |
| 55 | } else { |
| 56 | process.stdout.write(` ${report}\n`); |
| 57 | } |
| 58 | |
| 59 | if (!success) { |
| 60 | printDiagnostics(diagnostics); |
| 61 | process.exitCode = 1; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Compiles a TypeScript project. |
no test coverage detected