From dd93216954089f41d20a6a11ea7289978f8ebdbe Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Fri, 23 Jun 2017 18:28:33 -0700 Subject: [PATCH] [Fix] fix spurious "test exited without ending" Fixes #223. @Raynos identified this line as the issue: https://github.com/substack/tape/issues/223#issuecomment-167920577 Let's finally fix this :) --- bin/tape | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/tape b/bin/tape index 498910cd..8fdbbdd9 100755 --- a/bin/tape +++ b/bin/tape @@ -26,10 +26,12 @@ opts.require.forEach(function(module) { }); opts._.forEach(function (arg) { - glob(arg, function (err, files) { - files.forEach(function (file) { - require(resolvePath(cwd, file)); - }); + // If glob does not match, `files` will be an empty array. + // Note: `glob.sync` may throw an error and crash the node process. + var files = glob.sync(arg); + + files.forEach(function (file) { + require(resolvePath(cwd, file)); }); });