【问题标题】:ember-cli exclude a directory beneath "tests" from being watched by "ember serve"ember-cli 排除“tests”下的目录被“ember serve”监视
【发布时间】:2014-12-16 21:50:39
【问题描述】:

有没有办法让“tests”的子目录不被 ember serve 监视?

例如。我在“测试”下有一个名为“selenium”的目录。

如果“ember serve”正在运行并且我在 selenium 文件夹中执行“echo xyz > bam”,

ember 服务控制台将输出“file changed selenium/bam”并重建应用程序。

我想了解是否有办法排除整个 selenium 目录而不将其移出测试文件夹(即使现在我正在移动目录)

【问题讨论】:

    标签: ember-cli


    【解决方案1】:

    任一:

    您可以使用broccoli-unwatched-tree

    在使用 module.exports = app.toTree(seleniumTree); 将该树添加到应用程序之前,只需将 var seleniumTree = new UnwatchedTree('tests/selenium'); 添加到您的 Brocfile.js 中即可

    您可以像其他任何树一样继续使用此树,但由于它的实现方式,标准 Broccoli::Watcher 类不会检查它是否有文件更改。


    或:

    您也可以自己实现此功能,方法是添加一个对象,该对象导出 broccoli watcher 期望的 read() 和 cleanup() 函数,将 cleanup() 函数留空,就像 broccoli-bower 所做的那样。

    // Almost the same as using a plain string for a tree; but unlike a plain
    // string, Broccoli won't watch this
    function UnwatchedTree (dir) { this.dir = dir }
    UnwatchedTree.prototype.read = function (readTree) { return this.dir }
    UnwatchedTree.prototype.cleanup = function () { }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-14
      • 1970-01-01
      • 1970-01-01
      • 2014-11-18
      • 2015-08-06
      • 1970-01-01
      相关资源
      最近更新 更多