ember-cli exclude a directory beneath “tests” from being watched by “ember serve”

ⅰ亾dé卋堺 提交于 2019-12-11 10:05:56

问题


Is there a way to exclude a subdirectory of "tests" from being watched by ember serve?

ex. I have a dir under "tests" called "selenium".

If 'ember serve' is running and I do "echo xyz > bam" in the selenium folder,

the ember serve console will output "file changed selenium/bam" and rebuild the app.

I would like to understand if there is a way to exclude the entire selenium dir without moving it out of the tests folder ( even though for now I am moving the dir)


回答1:


either:

You can use broccoli-unwatched-tree.

Just add var seleniumTree = new UnwatchedTree('tests/selenium'); to your Brocfile.js before you add that tree to your application with module.exports = app.toTree(seleniumTree);

You can continue to use this tree just like any of the others, but due to the way it is implemented the standard Broccoli::Watcher class will not check it for file changes.


or:

You could also implement this functionality yourself by adding an object that exports the read() and cleanup() functions that are expected by the broccoli watcher, leaving the cleanup() function empty as is done for 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 () { }


来源:https://stackoverflow.com/questions/27514587/ember-cli-exclude-a-directory-beneath-tests-from-being-watched-by-ember-serve

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!