From 63c5a09a7c2eb2c56bd3a88bed71a9a1aa0a6922 Mon Sep 17 00:00:00 2001 From: Lloyd Brookes Date: Fri, 30 Aug 2024 17:28:42 +0100 Subject: [PATCH] yield --- index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.js b/index.js index 0fb0c8b..c486cfb 100644 --- a/index.js +++ b/index.js @@ -47,6 +47,7 @@ class TestRunner { console.log(`${ansi.format(test.metadata.file || '', ['magenta'])} ${test.name}`) try { await test.run() + yield test } catch (err) { console.log(`${ansi.format(test.metadata.file || '', ['magenta'])} ${test.name} - ${ansi.format('Failed', ['red'])}`) /* Crash the process */ @@ -55,6 +56,7 @@ class TestRunner { } } + /* not used by start() */ async runAll () { const result = [] for await (const test of this.run()) { @@ -91,6 +93,7 @@ class TestRunner { } this.tests = only.length ? only : tests + for await (const test of this.run()) { if (test.data) { console.log(indent(os.EOL + util.inspect(test.data, { colors: true }) + os.EOL, ' '))