使用TFS 2015运行Jestunit testing
有没有人试图整合玩笑unit testing与TFS 2015? 我试图使用Chutzpahtesting适配器( https://visualstudiogallery.msdn.microsoft.com/f8741f04-bae4-4900-81c7-7c9bfb9ed1fe?SRC=VSIDE ),但它无法识别开玩笑。 我收到下面的错误: 无法findvariablesJEST
当我通过“npmtesting”运行unit testing时,我得到了结果。 但是为了与TFS 2015集成,我需要一个可以运行Jestunit testing的testing运行器,以便我可以与TFS 2015提供的vstest.console.exe一起运行unit testing,因此它可以pipe理构build结果并在构build中发布结果总结报告。
任何帮助,将不胜感激!!
任何可以使用下面的命令运行testing的testing运行器应该可以工作(考虑到系统上安装了VS 2015):“C:\ Program Files(x86)\ Microsoft Visual Studio 14.0 \ Common7 \ IDE \ CommonExtensions \ Microsoft \ TestWindow \ vstest.console .exe“”\ test.js“/ UseVsixExtensions:true
我不确定是不是开玩笑,但有一个整洁的npm包,可以将基于TAP的结果转换为xUnit XMLformat,然后您可以发布到TFS。
看看tap-xunit 。
我有一个构build环境的JavaScripttesting是由各种工具和框架(AVA,摩卡,茉莉花等)完成。 我们决定将它们全部导出为TAP格式,运行它们,然后将其发布到tap-xunit,然后发布到TFS。
基本上,你需要这样的东西:
npm test | tap-xunit > results.xml
将结果传送到tap-xunit并将其保存到XML中。 这给你一个XML格式为xUnit,你可以发布到TFS。 如果您正在运行TFS 2015,我强烈build议使用vNext构build,让这些运行更容易。 检查“发布testing结果”构build步骤。
如果您使用XAML构build运行,此链接将帮助您: 使用Chutzpah在Team Foundation Service上进行Javascriptunit testing
如果您正在运行vNext构build,请在此博客中尝试使用Jasmine.JStesting(也是一种JavaScripttesting)提到的详细步骤。
在Merlin的答案的扩展,这里是我已经实现发布笑话testing结果和代码覆盖到TFS2015 vNext构build(我正在使用create-react-app样板):
首先在正在运行代理的服务器上安装所需的软件包:
npm install -g jest-json-to-tap
npm install -g tap-xunit
-
configurationjest输出json,将package.json中的“test”任务改为:“test”:“react-scripts test –env = jsdom –json”,
-
在package.json中configurationjest选项:“jest”:{“coverageReporters”:[“cobertura”]}
-
创build了一个vNext构build(TFS2015v4),其中包含以下任务:
一个。 “npm”任务,command = run,arguments = test – –coverage | jest-json-to-tap | tap-xunit> TEST-result.xml
湾 “发布testing结果”任务,format = JUnit
C。 “public code coverage results”任务,代码覆盖率工具= Cobertura,Summary file = $(Build.Repository.LocalPath)\ coverage \ cobertura-coverage.xml
- 确保你的构build的“variables”包括设置环境variables“CI”=“true”
注意: – testing结果将不包括时间和程序集 – 为将来扩展…
瞧'! 运行此构build将正确发布testing结果和代码覆盖率统计信息以及报告工件。
- NodeJS – 在process.oncallback中testingunit testingsetTimeout
- 当代码在node_modules中链接时,configurationjest代码覆盖范围
- React Jest示例不起作用
- 在CircleCI上运行Jest时出错:“npmtesting意外死亡”
- 模拟一个依赖的构造函数Jest
- 使用Jest CLI时如何获得承诺?
- Jesttesting简单的香草JavaScript – 不能读取null的属性'addEventListener'
- React组件在浏览器中正确渲染,但Jesttesting时出现错误:“只有ReactOwner可以引用”
- 笑npm脚本的正则expression式