Gulp mean.io单元测试不运行

Gulp mean.io单元测试不运行,gulp,mocha.js,mean.io,Gulp,Mocha.js,Mean.io,从全新的mean.io应用程序开始,即 mean init newApp cd newApp npm install [1] bower install [1] npm安装-dev会导致npm永远运行,并最终因内存不足错误而失败,因此我运行了npm安装,然后针对devDependencies中列出的每个包分别运行了npm安装devPackage gulp env:test mochaTest的输出是 也没有测试失败,而且在文章包中肯定有很多测试要运行,所以我不明白为什么它们没有被接受 注意:我

从全新的mean.io应用程序开始,即

mean init newApp
cd newApp
npm install [1]
bower install
[1] npm安装-dev会导致npm永远运行,并最终因内存不足错误而失败,因此我运行了npm安装,然后针对devDependencies中列出的每个包分别运行了npm安装devPackage

gulp env:test mochaTest的输出是

也没有测试失败,而且在文章包中肯定有很多测试要运行,所以我不明白为什么它们没有被接受

注意:我必须按住CTRL-C键才能停止吞咽任务并返回提示

应用程序本身在开箱即用的情况下运行良好。如果我运行“吞咽测试”,那么“因果报应测试”运行良好-摩卡测试仍然被忽略

系统:

节点v0.12.2 npm v2.7.4 平均值v0.9.26
好的,经过一些调试,我发现这是mean.io源中的一个bug

在gulp/test.js中,应更改以下行:

第20行: 需要“../node\u modules/meanio/lib/core\u modules/module/util”。预加载“../p”

同样,第24行:

return gulp.src('../packages/**/server/tests/*.js', {read: false})

node_modules/meanio/lib/core_modules/module/util preload函数现在将失败,但您可以通过修补walk函数中的2条realPath行来解决此问题:

// recursively walk modules path and callback for each file
function walk(wpath, type, excludeDir, callback) {
  // regex - any chars, then dash type, 's' is optional, with .js or .coffee extension, case-insensitive
  // e.g. articles-MODEL.js or mypackage-routes.coffee
  var rgx = new RegExp('(.*)-' + type + '(s?).(js|coffee)$', 'i');
  if (!fs.existsSync(wpath)) return;
  fs.readdirSync(wpath).forEach(function(file) {
    var newPath = path.join(wpath, file);
    var stat = fs.statSync(newPath);
    if (stat.isFile() && (rgx.test(file) || (baseRgx.test(file)) && ~newPath.indexOf(type))) {
      var realPath = fs.realpathSync(newPath);
      callback(realPath);
    } else if (stat.isDirectory() && file !== excludeDir && ~newPath.indexOf(type)) {
      walk(newPath, type, excludeDir, callback);
    }
  });
}

好的,经过一些调试,我发现这是mean.io源中的一个bug

在gulp/test.js中,应更改以下行:

第20行: 需要“../node\u modules/meanio/lib/core\u modules/module/util”。预加载“../p”

同样,第24行:

return gulp.src('../packages/**/server/tests/*.js', {read: false})

node_modules/meanio/lib/core_modules/module/util preload函数现在将失败,但您可以通过修补walk函数中的2条realPath行来解决此问题:

// recursively walk modules path and callback for each file
function walk(wpath, type, excludeDir, callback) {
  // regex - any chars, then dash type, 's' is optional, with .js or .coffee extension, case-insensitive
  // e.g. articles-MODEL.js or mypackage-routes.coffee
  var rgx = new RegExp('(.*)-' + type + '(s?).(js|coffee)$', 'i');
  if (!fs.existsSync(wpath)) return;
  fs.readdirSync(wpath).forEach(function(file) {
    var newPath = path.join(wpath, file);
    var stat = fs.statSync(newPath);
    if (stat.isFile() && (rgx.test(file) || (baseRgx.test(file)) && ~newPath.indexOf(type))) {
      var realPath = fs.realpathSync(newPath);
      callback(realPath);
    } else if (stat.isDirectory() && file !== excludeDir && ~newPath.indexOf(type)) {
      walk(newPath, type, excludeDir, callback);
    }
  });
}

基于此创建拉取请求:基于此创建拉取请求:
// recursively walk modules path and callback for each file
function walk(wpath, type, excludeDir, callback) {
  // regex - any chars, then dash type, 's' is optional, with .js or .coffee extension, case-insensitive
  // e.g. articles-MODEL.js or mypackage-routes.coffee
  var rgx = new RegExp('(.*)-' + type + '(s?).(js|coffee)$', 'i');
  if (!fs.existsSync(wpath)) return;
  fs.readdirSync(wpath).forEach(function(file) {
    var newPath = path.join(wpath, file);
    var stat = fs.statSync(newPath);
    if (stat.isFile() && (rgx.test(file) || (baseRgx.test(file)) && ~newPath.indexOf(type))) {
      var realPath = fs.realpathSync(newPath);
      callback(realPath);
    } else if (stat.isDirectory() && file !== excludeDir && ~newPath.indexOf(type)) {
      walk(newPath, type, excludeDir, callback);
    }
  });
}