运行angularjs karma示例时出错

时间:2022-07-02 20:26:21

In the introtokarma app, I changed the karma-e2e-config.js file as follows:

在introtokarma应用程序中,我更改了karma-e2e-config。js文件如下:

module.exports = function(config) {
  config.set({
    basePath : '../',
      files : ['tests/e2e/**/*.js'],
      frameworks: ['ng-scenario'],
      autoWatch : false,
      browsers : ['Chrome'],
      singleRun : true,
      proxies : {
        '/': 'http://localhost:8000/'
      },
      junitReporter : {
        outputFile: 'test_out/e2e.xml',
        suite: 'e2e'
      }
  });
};

When running the code, I get the following output:

在运行代码时,我得到如下输出:

C:\Project\introtokarma\config>karma start karma-e2e.conf.js
INFO [karma]: Karma v0.10.1 server started at localhost:9877/
INFO [launcher]: Starting browser Chrome
WARN [launcher]: The path should not be quoted.
Normalized the path to C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
INFO [Chrome 28.0.1500 (Windows 7)]: Connected on socket id pfBNNRs-3wAdgT-QsheL
Chrome 28.0.1500 (Windows 7): Executed 0 of 0 ERROR (0.207 secs / 0 secs)

项目C:\ \ introtokarma \ config >业力karma-e2e.conf开始。karma v0.10.1服务器启动于localhost:9877/ INFO [launcher]:启动浏览器Chrome警告[launcher]:路径不应该被引用。规范化的路径C:\Program Files (x86)\Google\Chrome\ \ chrome应用程序。exe INFO [Chrome 28.0.1500 (Windows 7)]:连接到socket id pfBNNRs-3wAdgT-QsheL Chrome 28.0.1500 (Windows 7):执行0错误(0.207秒/ 0秒)

5 个解决方案

#1


26  

For karma v0.10.2 and latest angular-phonecat try next command:

karma v0.10.2和最新的angular-phonecat尝试下一个命令:

npm install -g karma-ng-scenario karma-junit-reporter

npm安装-g karma-ng-scenario karma-junit-reporter

#2


4  

You need to change the files key array of the config block and add a frameworks key.

您需要更改配置块的文件键数组并添加一个框架键。

the files key looks like this:

文件键如下:

files: [
    ANGULAR_SCENARIO,
    ANGULAR_SCENARIO_ADAPTER,
    'test/e2e/**/*.js'
]

Remove the ANGULAR_SCENARIO, and ANGULAR_SCENARIO_ADAPTER lines.

删除ANGULAR_SCENARIO和ANGULAR_SCENARIO - adapter行。

So, in the end, it just looks like this:

最后,它是这样的

files: [
    'test/e2e/**/*.js'
]

Then add a framkeworks key with an array and one value of ng-scenario:

然后添加一个带有数组和一个ng-scenario值的framkeworks键:

frameworks: ['ng-scenario']

Hope that helps.

希望有帮助。

#3


1  

Besides installing the karma-ng-scenario node module as @rkshnsk said, I also had to add it to the plugins array:

@rkshnsk说,除了安装karma-ng-scenario节点模块外,我还必须将它添加到plugins数组中:

  plugins : ['karma-ng-scenario'],

#4


0  

It should be "test" instead of "tests" in

它应该是“测试”而不是“测试”

      files : ['tests/e2e/**/*.js'],

#5


0  

Thanks for your replies. I switched to karma 0.8.7 and everything works now.

谢谢你的回复。我切换到karma 0.8.7,现在一切正常。

#1


26  

For karma v0.10.2 and latest angular-phonecat try next command:

karma v0.10.2和最新的angular-phonecat尝试下一个命令:

npm install -g karma-ng-scenario karma-junit-reporter

npm安装-g karma-ng-scenario karma-junit-reporter

#2


4  

You need to change the files key array of the config block and add a frameworks key.

您需要更改配置块的文件键数组并添加一个框架键。

the files key looks like this:

文件键如下:

files: [
    ANGULAR_SCENARIO,
    ANGULAR_SCENARIO_ADAPTER,
    'test/e2e/**/*.js'
]

Remove the ANGULAR_SCENARIO, and ANGULAR_SCENARIO_ADAPTER lines.

删除ANGULAR_SCENARIO和ANGULAR_SCENARIO - adapter行。

So, in the end, it just looks like this:

最后,它是这样的

files: [
    'test/e2e/**/*.js'
]

Then add a framkeworks key with an array and one value of ng-scenario:

然后添加一个带有数组和一个ng-scenario值的framkeworks键:

frameworks: ['ng-scenario']

Hope that helps.

希望有帮助。

#3


1  

Besides installing the karma-ng-scenario node module as @rkshnsk said, I also had to add it to the plugins array:

@rkshnsk说,除了安装karma-ng-scenario节点模块外,我还必须将它添加到plugins数组中:

  plugins : ['karma-ng-scenario'],

#4


0  

It should be "test" instead of "tests" in

它应该是“测试”而不是“测试”

      files : ['tests/e2e/**/*.js'],

#5


0  

Thanks for your replies. I switched to karma 0.8.7 and everything works now.

谢谢你的回复。我切换到karma 0.8.7,现在一切正常。