teamcity - 如何在 team city 中添加构建步骤来运行 Node Js 单元测试(Mocha 框架)

标签 teamcity

我有一个 NodeJs 应用程序。目前我正在使用 team city 来构建和部署该应用程序。 现在我想在部署之前运行单元测试用例。我使用 Mocha 框架和 Chai 来编写测试用例。 我在 team city 中没有看到任何 Mocha 或 Node J 的运行者类型。

我知道需要在 teamcity 服务器上安装一些插件。

有人知道这个插件是什么以及我需要遵循哪些步骤吗?

最佳答案

您不必安装任何特定的 TeamCity 插件,您必须使用能够编写 TeamCity 的测试报告器 service messages ,例如mocha-teamcity-reporter ,这只是另一个 npm 包。

在构建步骤中运行 mocha --reporter mocha-teamcity-reporter test 后,您将获得 TeamCity 使用的测试,因此 Command-Line Runner 可能会用于此目的。

最好将此命令提取到单独的 script 中。在您的 package.json 中,例如:

"test:ci": "mocha --reporter mocha-teamcity-reporter test"

并在构建步骤中使用npm run test:ci

关于teamcity - 如何在 team city 中添加构建步骤来运行 Node Js 单元测试(Mocha 框架),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48311822/

相关文章:

docker - 如何将 docker 镜像从一个 TeamCity 构建传递到另一个?

TeamCity + Psake + SqlCmd Powershell 无限循环

nunit - 如何在 TeamCity NUnit runner 中获取当前的 TestContext

android - Gradle Sonar 运行者 : fail build on failed Quality Gate

c# - 在 TeamCity 中将 dotCover 作为 MSTest 构建步骤的一部分运行

java - mvn执行:java throws ClassNotFoundException when executed on Jetbrains TeamCity

msbuild 从属性组创建项目组

teamcity - 列出远程引用失败 : java.net.ConnectException : Connection time out: github. com

Teamcity Octopus-deploy 集成 - 强制重新部署预先存在的版本(使用 --force 选项)

teamcity - 使用 TeamCity 设置 Orchard 项目的部署