如何在 node 上运行Jasmine测试.来自命令行的js?我已经通过npm安装了jasmine node ,并编写了一些测试.我想在spec
目录中运行测试,并在终端中获得结果,这可能吗?
如何在 node 上运行Jasmine测试.来自命令行的js?我已经通过npm安装了jasmine node ,并编写了一些测试.我想在spec
目录中运行测试,并在终端中获得结果,这可能吗?
编辑
这似乎不再是当前的最佳答案,因为包裹没有得到维护.请看下面的答案
你能做到的
从你的测试目录
sudo npm install jasmine-node
这把茉莉花装进/node_模块/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 failures, 0 skipped