【问题标题】:How to run tests with gruntJS如何使用 gruntJS 运行测试
【发布时间】:2013-08-24 10:28:45
【问题描述】:

那么,如何在 gruntjs 中运行测试套件?我认为它应该非常简单直接,但对我来说不是:)

由于 gruntjs 应该能够运行测试,我认为我可以只运行“grunt test”,但由于某种原因需要服务器运行。我尝试使用“grunt server watch”在另一个进程中启动它,但是“grunt test”再次失败。

grunt 应该如何工作?

【问题讨论】:

  • 您可以发布 grunt 文件以显示您使用的测试框架。

标签: node.js unit-testing gruntjs


【解决方案1】:

'grunt test' 是一项在需要时也会启动服务器的任务。它启动一个测试运行器,例如 karma 和 karma 在浏览器环境中运行测试。

诀窍是在karma.conf.js中运行karma并提供配置项

A sample gruntfile on gruntjs website 展示了如何使 qUnit 与 grunt 一起工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-07-19
    • 2015-12-16
    • 1970-01-01
    • 1970-01-01
    • 2021-04-23
    • 2014-01-09
    • 2015-03-17
    相关资源
    最近更新 更多