GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — node-java/scripts/testRunner.ts at master · swsharp/node-java Expand file tree/ Copy pathtestRunner.tsMore file actions 55 lines (46 loc) · 1.71 KB / Copy pathtestRunner.tsFile metadata and controls55 lines (46 loc) · 1.71 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 // testRunner.js // This is a custom test runner. All tests are run with vitest, but in separate // processes, which allows us to test java with different configuration options. import chalk from "chalk"; import findRoot from "find-root"; import * as glob from "glob"; import childProcess, { ExecException } from "node:child_process"; import path from "node:path"; const root = findRoot(__dirname); const tests = glob .sync("*.test.ts", { cwd: path.join(root, "testAsyncOptions") }) .sort((a: string, b: string) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase())); tests.unshift("test"); // Arrange to run the primary tests first, in a single process async function runTest(testIndex: number, testArgs: string): Promise<void> { const vitest = path.join("node_modules", ".bin", "vitest"); const cmd = testArgs === "test" ? `vitest --dir test` : `${vitest} ${testArgs}`; console.log(chalk.cyan(`(${testIndex + 1}/${tests.length}) running "${cmd}"...`)); return new Promise<void>((resolve, reject) => { childProcess.exec(cmd, (error: ExecException | null, stdout: string, stderr: string) => { const errText = stderr.toString(); if (errText !== "") { console.error(chalk.bold.red(errText)); } process.stdout.write(stdout.toString()); if (error) { return reject(error); } resolve(); }); }); } console.log("test to run", tests); async function runAll(): Promise<void> { for (let i = 0; i < tests.length; i++) { const test = tests[i]; await runTest(i, test); } } runAll() .then(() => { console.log(chalk.green("Tests completed successfully!")); }) .catch((err) => { console.error(chalk.bold.red(err)); process.exit(1); }); |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |