Karma + PhantomJS +无法上网 [英] Karma + PhantomJS + no internet access
问题描述
我需要在没有互联网连接的持续集成服务器上使用PhantomJS运行Karma测试。每个构建都从运行 除PhantomJS外,一切正常。即使phantomjs软件包在npm-cache中,它会直接从 bitbucket.org 下载实际的二进制文件(在我的情况下为.exe),并且由于没有inet访问权限而显然失败。 我尝试在全局预安装PhantomJS软件包( 我尝试了不同版本的PhantomJS(1.9.7,1.9.6,1.9 .2)和Karma(0.11,0.10) - 没有区别。 这是我的 package.json : 这就是我看看我是否运行Karma PhantomJS安装了'-g': (并且挂起... Ctrl + C构建继续) p> 我不明白为什么会这样。 谢谢! 根据 PhantomJS NPM软件包文档,您可以当运行 默认值为 https:// bit bucket.org/ariya/phantomjs/downloads 。 另外,如果您将PhantomJS放在您的路径上,它应该尝试使用它。 I need to run Karma tests using PhantomJS on a continuous integration server with no internet access. Every build starts from running Everything works well except PhantomJS. Even though phantomjs package is in npm-cache it tries to download actual binary (.exe in my case) directly from bitbucket.org and obviously fails due to no inet access. I tried to pre-install PhantomJS package globally ( I tried different versions of PhantomJS (1.9.7, 1.9.6, 1.9.2) and Karma (0.11, 0.10) -- no difference. Here's my package.json: And here's what I see if I run Karma having PhantomJS installed with '-g': (and hangs... After Ctrl+C build is continued) I don't get why this is happening. Questions Thank you! According to the PhantomJS NPM package documentation you can set the The default is https://bitbucket.org/ariya/phantomjs/downloads. Also, if you put PhantomJS on your path, it should try to use that. 这篇关于Karma + PhantomJS +无法上网的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! npm install --no-registry
,然后执行
开始.Grunt Karma配置为单次运行( singleRun:true
)
npm install -g phantomjs
)。现在二进制文件在离线模式下解析,测试运行通过并且通过,一切看起来都很好,但是...直到我点击 npm install -g ...
全局显式安装PhantomJS包时。如果我没有这样做并让它从 BitBucket 自动下载它运行正常)。
PhantomJS的版本在两种情况下都是相同的,我仔细检查过。
devDependencies:{
grunt:〜0.4,
karma:〜0.10,
grunt-karma:〜0.6
}
> npm install -g phantomjs
完成。 Phantomjs二进制可在.....
phantomjs@1.9.7-1 C:\ Users \ ..... \\\
pm\\\
ode_modules\phantomjs
> ; karma start --single-run
INFO [karma]:在http:// localhost:9876 /
处启动的Karma v0.10.9服务器INFO [launcher]:启动浏览器PhantomJS
INFO [PhantomJS 1.9.7(Windows 7)]:在套接字上连接JjD-wPAWrUeuz1NBTw02
日志:'JQMIGRATE:日志记录处于活动状态'
PhantomJS 1.9.7(Windows 7):执行60个60(SUCCESS)(0.362秒/ 0.204秒)
WARN [发射器]:PhantomJS在2000毫秒内没有遇害,发送SIGKILL。
npm install
时,将 PHANTOMJS_CDNURL
环境变量设置为指向另一个(本地)HTTP端点。
PHANTOMJS_CDNURL = http://some.server.here/downloads npm install phantomjs
npm install --no-registry
and then grunt
Grunt Karma is configured for single run (singleRun: true
)npm install -g phantomjs
). Now the binary is resolved in offline mode, tests run pass and pass, everything looks fine but... Karma test suite now never ends (presumably due to PhantomJS never exits) until I hit Ctrl+C. (It only happens when I explicitly install PhantomJS package globally with npm install -g ...
. If I'm not doing that and let it to be downloaded from the BitBucket automatically it run fine).
The version of PhantomJS is the same in both cases, I double checked."devDependencies": {
"grunt": "~0.4",
"karma": "~0.10",
"grunt-karma": "~0.6"
}
> npm install -g phantomjs
Done. Phantomjs binary available at .....
phantomjs@1.9.7-1 C:\Users\.....\npm\node_modules\phantomjs
> karma start --single-run
INFO [karma]: Karma v0.10.9 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.7 (Windows 7)]: Connected on socket JjD-wPAWrUeuz1NBTw02
LOG: 'JQMIGRATE: Logging is active'
PhantomJS 1.9.7 (Windows 7): Executed 60 of 60 SUCCESS (0.362 secs / 0.204 secs)
WARN [launcher]: PhantomJS was not killed in 2000 ms, sending SIGKILL.
_
PHANTOMJS_CDNURL
environment variable to point to a different (local) HTTP endpoint when you run npm install
.PHANTOMJS_CDNURL=http://some.server.here/downloads npm install phantomjs