From 036f7a05633158a032b5026d53a952fabc5ff4ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Matte?= Date: Sun, 4 Dec 2022 16:45:57 -0500 Subject: [PATCH] Ignore test file with no metaltest exported --- suite.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/suite.js b/suite.js index 443d8de..e8f1b79 100644 --- a/suite.js +++ b/suite.js @@ -30,6 +30,7 @@ import { consolereporter, totalreporter } from 'metaltest' const suite = async (folder = '.') => { const absolutePaths = getStackAbsolutePaths() const absolutePath = absolutePaths[2] + const fileIgnored = [] const total = totalreporter() @@ -40,9 +41,19 @@ const suite = async (folder = '.') => { const module = join(absolutePath, file) const { test } = await import(module) + + if (test === undefined) { + fileIgnored.push(file) + continue + } + await test.run(consolereporter(), total) } + for (const file of fileIgnored) { + console.log(`The file ${file} doesn't export the metaltest object`) + } + console.log(total.msg()) }