+1
-1
| { | ||
| "name": "impunity", | ||
| "version": "1.0.1", | ||
| "version": "1.0.2", | ||
| "description": "js test runner that finds unit tests in any imported ES module", | ||
@@ -5,0 +5,0 @@ "main": "src/main.js", |
+2
-3
@@ -56,7 +56,6 @@ import * as path from "path"; | ||
| export default async function findTests(entryPoint, symbol, forceEsmDirs) { | ||
| entryPoint = path.resolve(entryPoint); | ||
| export default async function findTests(entryPoint, rootDir, symbol, forceEsmDirs) { | ||
| const entryPointUrl = `file://${entryPoint}`; | ||
| const forceEsmDirUrls = (forceEsmDirs || []).map(dir => `file://${path.resolve(dir)}`); | ||
| const projectDir = path.dirname(entryPoint); | ||
| const projectDir = path.dirname(rootDir); | ||
| const projectDirUrl = `file://${projectDir}/`; | ||
@@ -63,0 +62,0 @@ |
+5
-1
@@ -6,2 +6,3 @@ import * as commander from "commander"; | ||
| import runTests from "./runner.mjs"; | ||
| import * as path from "path"; | ||
@@ -13,2 +14,3 @@ const args = commander.default; | ||
| .option('--symbol [symbol]', 'the function to look for in each file to return the tests object', "tests") | ||
| .option('--root-dir [dir]', 'the function to look for in each file to return the tests object') | ||
| .option('--force-esm-dirs [dirs...]', 'also assume .js files are ES modules in this directory') | ||
@@ -18,3 +20,5 @@ .parse(process.argv); | ||
| async function main() { | ||
| const tests = await findTests(args.entryPoint, args.symbol, args.forceEsmDirs); | ||
| let entryPoint = path.resolve(args.entryPoint); | ||
| let rootDir = args.rootDir ? path.resolve(args.rootDir) : path.dirname(entryPoint); | ||
| const tests = await findTests(entryPoint, rootDir, args.symbol, args.forceEsmDirs); | ||
| const failures = await runTests(tests); | ||
@@ -21,0 +25,0 @@ if (failures) { |
8674
2.75%180
1.69%