CHROME_BIN的环境变量设置不起作用 [英] Setting environment variable for CHROME_BIN does not work

查看:1043
本文介绍了CHROME_BIN的环境变量设置不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Karma来测试我的js脚本。在文档中,我应该为 CHROME_BIN 设置环境变量:



我设置为


%程序文件(x86)%\Google\Chrome\Application\Chrome.exe


但是当我在DOS中键入%CHROME_BIN%时,它会被截断为 C :\Program 程序文件中的空格



我可以做什么要解决这个问题?

解决方案

面对同样的问题,我通过编辑 karma.conf 配置目录中的.js karma-e2e.conf.js 文件。



更改:

  browsers = ['Chrome']; 
pre>

TO

  browsers = ['Your_System_Path_where_chrome_installed / chrome.exe']; 

在我的情况下,它是> C:/程序文件(x86)/Google/Chrome/Application/chrome.exe



,然后添加 C:\Program Files(x86)\Google\Chrome\Application\chrome.exe 环境变量路径






或cmd

  SET CHROME_BIN =C:\Program Files(x86)\Google\Chrome\Application\chrome.exe





/github.com/karma-runner/karma/blob/master/docs/config/03-browsers.md\">这里。



以及为什么chrome一个不工作我猜他们(Karma)已经从一些早期版本的chrome配置了他们的chrome路径。






更新:对于 AngularJS教程关注者:




  • 你还好吧在一些教程步骤上运行Karma测试运行器并解决这个问题时,请在 ... conf.js中添加这些角度方案依赖关系 文件,如下所示:




  = [
ANGULAR_SCENARIO,
ANGULAR_SCENARIO_ADAPTER,
....
.... //保留其余的行,因为它是
....
];



I'm trying to use Karma for testing my js scripts. In the doc it says I should set the environment variable for CHROME_BIN:

I've set it to

%programfiles(x86)%"\Google\Chrome\Application\Chrome.exe

but when I type %CHROME_BIN% in DOS, it fails as it's truncated to C:\Program of the space in Program Files.

What can I do to work around with this problem?

解决方案

Was facing the same issue and I solved it by editing the karma.conf.js and karma-e2e.conf.js files which is under config directory.

Change:

browsers = ['Chrome'];

TO

browsers = ['Your_System_Path_where_chrome_installed/chrome.exe'];

in my case it was > C:/Program Files (x86)/Google/Chrome/Application/chrome.exe

and then add C:\Program Files (x86)\Google\Chrome\Application\chrome.exe path to environment variables


or in cmd

SET CHROME_BIN = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"


Additional: Settings for other browsers can be seen here.

And about why chrome one is not working I guess they(Karma) have configured their chrome path from some earlier versions of chrome.


Update: For AngularJS tutorial Followers:

  • You still might face problems (as I faced) while running karma test runner on some tutorial steps and to resolve this: just add these "Angular Scenario Dependencies" in both the "...conf.js" files, like this:

files = [
  ANGULAR_SCENARIO,
  ANGULAR_SCENARIO_ADAPTER,
    ....
    ....  // keep rest of the lines as it is
    ....
];

这篇关于CHROME_BIN的环境变量设置不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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