Node.js   发布时间:2022-04-24  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了如何在Node.js上从命令行运行Jasmine测试?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
如何在Node.js上从命令行运行Jasmine测试?
我已经通过npm安装了茉莉花节点并写了一些测试。
我想在spec目录中运行测试并在终端中获得结果,这是可能吗?

解决方法

编辑

看来这不再是目前最好的答案,因为包是不保养的。请参见下面的答案

你可以这样做

从您的测试目录

sudo npm install jasmine-node

这会将jasmine安装到../node_modules/jasmine-node中

然后

../node_modules/jasmine-node/bin/jasmine-node --verbose --junitreport --noColor spec

从我的demo这样做

Player - 5 ms
    should be able to play a Song - 2 ms

    when song has been paused - 1 ms
        should inDicate that the song is currently paused - 0 ms
        should be possible to resume - 0 ms
    tells the current song if the user has made it a favorite - 1 ms

    #resume - 0 ms
        should throw an exception if song is already playing - 0 ms

Player - 5 ms
    should be able to play a Song - 2 ms

    when song has been paused - 1 ms
        should inDicate that the song is currently paused - 0 ms
        should be possible to resume - 0 ms
    tells the current song if the user has made it a favorite - 1 ms

    #resume - 0 ms
        should throw an exception if song is already playing - 0 ms

Finished in 0.01 seconds
5 tests,8 assertions,0 @R_401_4895@,0 skipped

大佬总结

以上是大佬教程为你收集整理的如何在Node.js上从命令行运行Jasmine测试?全部内容,希望文章能够帮你解决如何在Node.js上从命令行运行Jasmine测试?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。