gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 22:27:10 25 4
gpt4 key购买 nike

我有一个 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com