From df1ca5ca07f592a9840d706b3c016dbd42e8ed60 Mon Sep 17 00:00:00 2001 From: Paul B Date: Thu, 6 Mar 2014 10:50:10 +0100 Subject: [PATCH 1/2] Better to search for a package.json which is common rather than the git root to find tests --- lib/cmds/test.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/cmds/test.js b/lib/cmds/test.js index 00839dc..6b9ea25 100644 --- a/lib/cmds/test.js +++ b/lib/cmds/test.js @@ -5,6 +5,8 @@ http://yuilibrary.com/license/ */ var log = require('../log'), util = require('../util'), + find = util.find, + CWD = process.cwd(), git = require('../git'), path = require('path'), portfinder = require('portfinder'), @@ -433,7 +435,13 @@ mods = { canBatch = true; } if (canBatch) { - base = path.join(git.findRoot(), '../src'); + find(CWD, 'package.json', function(err, file) { + if (file) { + base = path.join(path.dirname(file), 'src'); + } else { + base = path.join(git.findRoot(), '../src'); + } + }); if (!this.modules) { this.modules = []; batch = fs.readdirSync(base); From 1056e7334ed9fa7f8c40daecc85bee6a0a4e211b Mon Sep 17 00:00:00 2001 From: Paul B Date: Thu, 6 Mar 2014 18:30:38 +0100 Subject: [PATCH 2/2] fix jshint errors --- lib/cmds/test.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/cmds/test.js b/lib/cmds/test.js index 6b9ea25..375a416 100644 --- a/lib/cmds/test.js +++ b/lib/cmds/test.js @@ -436,11 +436,11 @@ mods = { } if (canBatch) { find(CWD, 'package.json', function(err, file) { - if (file) { - base = path.join(path.dirname(file), 'src'); - } else { - base = path.join(git.findRoot(), '../src'); - } + if (file) { + base = path.join(path.dirname(file), 'src'); + } else { + base = path.join(git.findRoot(), '../src'); + } }); if (!this.modules) { this.modules = [];