标签: testem

Ember CLI代码覆盖率报告

我正在使用Ember CLI,我正在尝试将代码覆盖率报告与使用testem运行的内置Qunit测试集成.我试图使用伊斯坦布尔,但我无法找到要检测的文件,因为它似乎在查看tmp目录.我尝试在我的testem.json中执行此操作:

{
"framework": "qunit",
"serve_files": [
    "instrumented/components/*.js"
],
"before_tests": "istanbul instrument --output instrumented/components app/components",
"after_tests": "istanbul report",
"test_page": "tests/index.html",
"launch_in_ci": ["PhantomJS"],
"launch_in_dev": ["PhantomJS", "Chrome"],
"reporter": "tap"
}
Run Code Online (Sandbox Code Playgroud)

但我一直得到这样的错误:不行1错误---消息:>

        fs.js:684
          return binding.stat(pathModule._makeLong(path));
                         ^
        Error: ENOENT, no such file or directory '/Users/Robert/ui/tmp/class-tests_dist-hqZLfsWS.tmp/app/components'
            at Object.fs.statSync (fs.js:684:18)
            at InstrumentCommand.Command.mix.run (/usr/local/lib/node_modules/istanbul/lib/command/instrument.js:230:20)
            at runCommand (/usr/local/lib/node_modules/istanbul/lib/cli.js:58:19)
            at runToCompletion (/usr/local/lib/node_modules/istanbul/lib/cli.js:62:5)
            at Object.<anonymous> (/usr/local/lib/node_modules/istanbul/lib/cli.js:67:5)
            at Module._compile (module.js:456:26)
            at Object.Module._extensions..js (module.js:474:10)
            at Module.load (module.js:356:32)
            at Function.Module._load (module.js:312:12)
            at Function.Module.runMain (module.js:497:10)
Run Code Online (Sandbox Code Playgroud)

我也试过使用Karma,但我无法弄清楚配置.我也试过毯子,但这只是给了我一个虚假的报告,100%覆盖在已编译的代码上.

我不完全理解转换后的代码是如何工作的,我不确定最好的方法是什么,但我肯定会喜欢任何帮助,指出我如何获得一个很好的代码覆盖率报告的正确方向.

有没有人成功整合任何类型的代码覆盖率报告?

qunit ember.js testem ember-cli broccolijs

17
推荐指数
1
解决办法
2134
查看次数

推出具有特定扩展名的testem chrome浏览器

我正在尝试将Testem我的测试启动到Chrome浏览器并加载了特定的扩展程序,但默认情况下,它是一个空白的Chrome配置文件,它已启动,并且不会将扩展从一次运行延伸到另一次.

我的目标是例如必须Testem启动预先加载的Chrome浏览器,Ember Inspector以便我可以使用该工具调试测试.

我想知道这是否可行,如果可行,怎么做.

google-chrome google-chrome-extension ember.js testem

8
推荐指数
1
解决办法
817
查看次数

Karma自定义测试页面

Karma有一个内置context.html文件,可以加载测试页面.但它很糟糕.我可以指定自定义测试页吗?

我问的原因是因为我想在浏览器上看到mocha漂亮的界面.有没有办法用Karma插入?

Testem在浏览器上显示测试框架的界面; 有没有理由为什么Karma只显示一个丑陋的空白页?

@stackoverflow = are you happy now?yes:no
stackoverflow = happy now?ok:thanks
Run Code Online (Sandbox Code Playgroud)

javascript tdd mocha.js karma-runner testem

7
推荐指数
1
解决办法
1985
查看次数

不行PhantomJS意外退出

$ testem ci

not ok 1 PhantomJS - Browser "phantomjs /home/ubuntu/.nvm/v0.10.12/lib/node_modules/testem/assets/phantom.js http://localhost:7357/6092" exited unexpectedly.

1..1
# tests 1
# pass  0
# fail  1
Run Code Online (Sandbox Code Playgroud)

$ phantomjs --version

2014-07-28T00:24:22 [WARNING] Unable to load library icui18n "Cannot load library icui18n: (libicui18n.so.48: cannot open shared object file: No such file or directory)"
2014-07-28T00:24:22 [WARNING] phantomjs: cannot connect to X server
Run Code Online (Sandbox Code Playgroud)

怎么了?

testem 命令工作正常,所有测试都传入 Chrome

continuous-integration phantomjs gruntjs karma-runner testem

7
推荐指数
1
解决办法
3842
查看次数

如何使用ember-qunit为ember-cli构建的ember应用程序运行测试时,如何使源映射正常工作

我有一个使用的Ember应用程序ember-cli,我正在使用ember-qunit测试适配器编写我的测试,并testem按照ember-cli文档中的说明在浏览器中运行它们.虽然当我对我的应用程序感兴趣时,谷歌浏览器中的调试工作正常,但在运行测试时我无法使用许多调试功能,如断点.

我经常遇到一个问题,即我的测试失败,尽管我的实际应用程序似乎正常工作,并且在我的测试运行时调查我想要逐步执行代码的问题.

但当我进入我出现的代码时,vendor.js我只是看到了以下内容vendor.js:

// Please wait a bit.
// Compiled script is not shown while source map is being loaded!
Run Code Online (Sandbox Code Playgroud)

这两行是文件的第6行和第7行.前面的行是空白的,这两行是文件中的最后一行.调试器将文件的第一行突出显示,就好像它是源中的当前位置,但由于某种原因它无法显示源.

我可以继续执行代码,但我看不到任何东西.

但是,如果我vendor.js在开发人员工具源文件列表的源列表中找到它,那么它将作为单独的源选项卡打开,我可以看到我的所有代码.在这一点上,我有两个标签vendor.js,一个标签包含我所有的供应商资产,另一个标有上面引用的那些标签.

我猜测我的测试服务方式和我的应用程序在开发环境中的服务方式之间存在一些不同之处.

我使用以下版本的东西:

ember 1.9.1
ember-data 1.0.0-beta.14.1
ember-cli 0.1.9
qunit 1.17.1
ember-qunit 0.2.0
testem 0.6.33
Run Code Online (Sandbox Code Playgroud)

虽然我已经开了一堆,但我并没有任何关于问题源于何处的线索.也许它与如何testem运行测试有关?或者它可能是我的测试中包含的东西有一个混乱的源地图?

我感谢任何帮助或想法.

ember.js source-maps testem ember-cli ember-qunit

6
推荐指数
1
解决办法
1942
查看次数

试图在Array.prototype方法上窥探(Jasmine)会导致堆栈溢出

这很奇怪.使用testem带有jasmine2和以下规范的运行程序执行(尽管它正确地标记了没有期望):

describe('Spying on array.prototype methods', function(){
  it('should work this way', function(){
    spyOn( Array.prototype, 'push' ).and.callThrough();
    // expect(1).toBe(1);
  });
});
Run Code Online (Sandbox Code Playgroud)

但是,添加一个expect(任何expect!),它会导致堆栈溢出,并在testem控制台中显示以下消息:RangeError: Maximum call stack size exceeded. at http://localhost:7357/testem/jasmine2.js, line 980html报告页面符合规范,然后挂起而不显示任何实际结果.

最终我想做这样的事情:

describe('Some structure.method', function(){
  it('does not use native push', function(){
    spyOn( Array.prototype, 'push' ).and.callThrough();
    [].push(1); // actually more like `myStructure.myMethod('test')`
    expect( Array.prototype.push ).not.toHaveBeenCalled();
  });
});
Run Code Online (Sandbox Code Playgroud)

提前感谢能够揭示这种奇怪之处的人.我可以不监视原生原型方法吗?

javascript prototype spy jasmine testem

6
推荐指数
1
解决办法
3560
查看次数

ember-cli测试不使用docker中的phantomjs

运行时ember test --host 172.17.0.2 --test-port 4450,我收到以下错误.

Error: Browser failed to connect within 30s. testem.js not loaded?

由于我使用的是docker容器,我假设我需要将主机和端口更新为打开的docker主机和端口.

这是我的testem.js档案

/*jshint node:true*/
module.exports = {
  "framework": "qunit",
  "test_page": "tests/index.html?hidepassed",
  "phantomjs_debug_port": 4500,
  "disable_watching": true,
  "launch_in_ci": [
    "PhantomJS"
  ],
  "launch_in_dev": [
    "PhantomJS",
    "Chrome"
  ]
};
Run Code Online (Sandbox Code Playgroud)

phantomjs ember.js testem ember-cli

5
推荐指数
1
解决办法
316
查看次数