From ee76aa9f4f0b6f1e2b838ca2aef2f3e8a30f4493 Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Wed, 18 May 2016 16:16:29 +0100 Subject: [PATCH] api#run should return runStatus even when no files are found (#839) --- api.js | 2 +- test/cli.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/api.js b/api.js index ef93bcf..80f6e6a 100644 --- a/api.js +++ b/api.js @@ -105,7 +105,7 @@ Api.prototype._run = function (files, _options) { file: undefined }); - return Promise.resolve([]); + return Promise.resolve(runStatus); } var cacheEnabled = self.options.cacheEnabled !== false; diff --git a/test/cli.js b/test/cli.js index ca6ae7c..4517147 100644 --- a/test/cli.js +++ b/test/cli.js @@ -290,3 +290,11 @@ test('handles NODE_PATH', function (t) { t.end(); }); }); + +test('works when no files are found', function (t) { + execCli('!*', function (err, stdout, stderr) { + t.is(err.code, 1); + t.match(stderr, 'Couldn\'t find any files to test'); + t.end(); + }); +});