当主人改变消息来源时,流浪汉上的咕噜业力测试咕噜/业力无法检测到它 [英] grunt karma testing on vagrant when host changes sources grunt/karma doesn't detect it

查看:140
本文介绍了当主人改变消息来源时,流浪汉上的咕噜业力测试咕噜/业力无法检测到它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这花了我很多时间来找出,但似乎无法找到这个解决方案。使用流浪者我运行一个运行咕噜/业力的Fedora 20客人。我在主机上编辑的源代码,但是当我保存grunt没有检测到变化,所以没有测试正在完成。



认为这是一个配置问题,所以尝试了很多组合这里的东西没有成功。最后,我打开了第二个ssh给客户 vagrang ssh ,并在另一个ssh终端 echo>>中更改了文件。 app / js / app.js 并且现在看到grunt / karma检测到这个变化并再次运行测试。



由于它没有x窗口或任何我用PhantomJS运行测试。另一个问题是,我必须在httpd.conf中设置 EnableSendfile off 来防止Apache在共享文本文件时发送垃圾(这是我在主机和web根目录下的项目)客人)。我的猜测是可能有另一个需要对节点进行的设置,以便它检测主机对共享上的文件所做的更改。它使用的是virtualBox共享。



有没有人经历过这种情况,有没有解决方案?似乎主机更改共享上的文件不会触发grunt / karma正在监听的事件,以指示文件已更改。



[更新]



尝试使用NFS和rsync共享,但NFS根本不起作用,rsync似乎只是在启动时同步。


$作为临时解决方案,我必须手动告诉文件在ssh终端中更新: / p>

  #start grunt并给我回指令:
grunt&
#当我更新文件时,告诉grunt已更新
touch -dnowtest / unit / loginSpec.js

有趣的是,如果我更新 app / js / login.js 并告诉grunt test / unit / loginSpec .js 已更新,它将再次运行测试,但使用旧的login.js,即使它已更改 cat app / js / login.js 显示更改。如果不是这样的解决方案将被设置为右窗口和2击键(向上箭头和进入)焦点

解决方案

这源于vboxsf(Virtualbox分片文件夹文件系统)同步中的一个已知错误以及解决此问题的方法只能由Virtualbox团队实施。人们对Gulp,Guard或Meteor.js(仅举几例)有类似的问题。



有一些解决方法可以使用...



Auto-rsync



Vagrant 1.5具有自动同步功能( rsync-auto ),可以监视指定的文件夹,并自动同步更改他们在实时。它使用特定于系统的API来检测文件更改,而不是轮询文件系统......

所以你应该在vagrant文​​件中定义你的共享。即:

$ p $ config.vm.synced_folder。,/ vagrant,输入:rsync



并打开额外的终端会话:

  $ vagrant rsync-auto 

然而,独自一人并不是最有效率的选择。您可以在这里找到 gruntfile vagrant插件 ,它可以帮助你使你的rsync运行更快更顺畅...... p>

希望它有帮助!


This took me ages to find out but can't seem to find a solution for this one. Using vagrant I run a Fedora 20 guest that runs grunt/karma. The sources I edit on my host but when I save grunt isn't detecting the change so no tests are being done.

Figured it was a configuration problem so tried many combinations of things here without success. Finally I opened a second ssh to the guest vagrang ssh and changed the file in the other ssh terminal echo " " >> app/js/app.js and see that now grunt/karma detects the change and runs the tests again.

Since it has no x windows or anything I'm running the tests with PhantomJS. Another problem was that I had to set EnableSendfile off in the httpd.conf to prevent Apache to send garbage when serving textfiles from the share (that's my project in host and web root in guest). My guess is there may be another setting that needs being done to node so it detects the changes made by the host to the files on the share. It's using virtualBox share.

Has anyone experienced this before and is there a solution for this? Seems that host machine changing files on the share doesn't trigger some event that grunt/karma is listening for to indicate the file has changed.

[update]

Tried NFS and rsync share but NFS didn't work at all and rsync seems to just sync on startup.

[update]

As a temporary solution I have to manually tell the file is updated in the ssh terminal:

#start grunt and give me back command:
grunt &
#when I update a file tell grunt it's updated
touch -d "now" test/unit/loginSpec.js

Funny that if I update app/js/login.js and tell grunt the test/unit/loginSpec.js is updated it will run the tests again but with the old login.js even though it has changed cat app/js/login.js shows the changes. If not for this the solution would be set focus to right window and 2 keystroke (arrow up and enter)

解决方案

This derives from a known bug in the synchronization of vboxsf (Virtualbox "sharded folder" filesystem) and the solution to this issue only can be implemented by the Virtualbox team. People have had similar problems with Gulp, Guard or Meteor.js (to name a few).

There are some workarounds that you could use…

Auto-rsync

Vagrant 1.5 has an auto-synchronization utility (rsync-auto) that watches specified folders, and automatically syncs changes as you make them in real-time. It uses system-specific APIs to detect file changes, rather than polling the file system…

So you just should define your shares in the vagrant file. I.e:

config.vm.synced_folder ".", "/vagrant", type: "rsync"


and open an additional terminal session running:

$ vagrant rsync-auto

However, this alone is not the most efficient option. Here you can find a gruntfile and a vagrant plugin that will help you make your rsync run faster and smoother...

Hope it helps!

这篇关于当主人改变消息来源时,流浪汉上的咕噜业力测试咕噜/业力无法检测到它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆