为什么在`jasmine init`和`jasmine examples`之后运行`jasmine`什么都不做? [英] Why does running `jasmine` after `jasmine init` and `jasmine examples` do nothing?

查看:130
本文介绍了为什么在`jasmine init`和`jasmine examples`之后运行`jasmine`什么都不做?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过运行 npm install jasmine -g 全局安装了jasmine。

I have globally installed jasmine by running npm install jasmine -g.

运行 jasmine -v 给我

jasmine v2.5.0
jasmine-core v2.5.0

我根据 docs ,运行

jasmine init
jasmine examples

这创建了预期的 / spec 目录和 spec / support / jasmine.json file。

This created the expected /spec directory and the spec/support/jasmine.json file.

我的印象是,如果我现在运行 jasmine 我应该在控制台中看到一些测试输出。相反,它只是考虑它一秒钟然后什么都不做。

I am under the impression that if I now run jasmine I should see some test output in the console. Instead it simply thinks about it for a second and then does nothing.

我在Git Bash终端的Windows 7机器上运行节点v4.5.0。我也试过从Windows cmd提示符运行它,但这也不起作用。

I'm running node v4.5.0 on a Windows 7 machine in a Git Bash terminal. I've tried running it from the Windows cmd prompt as well but that doesn't work either.

推荐答案

茉莉花确实运行了,但是当你单独运行茉莉花时,它不会报告任何内容。 (您可以通过将 console.log 置于 describe 函数中来确认,确实会记录它。 )

well jasmine does run, but it doesn't report anything when you run jasmine alone. (you can confirm that by putting console.log inside describe functions and see that indeed it will log.)

下载最新版本,它将有一个你可以运行的html文件,它将为你完成所有的工作。

download the latest release, it will have an html file that you can run which will do all the work for you.

https://github.com/jasmine/jasmine/releases

基本上运行jasmine需要一个 boot.js 文件来进行配置。 html报告者的 jasmine-html.js 文件。你可以通过运行 SpecRunner.html 来弄清楚一切。

basically running jasmine requires a boot.js file for configurations. a jasmine-html.js file for the html reporter. you can figure out everything yourself by running the SpecRunner.html.

我的个人偏好是使用量角器并拥有记者在protractor.config文件中配置。

my personal preference is to use protractor and have the reporter configured in the protractor.config file.

如果你想运行 jasmine 并让它运行,你需要添加自己的boot.js和reporter,并在 jasmine.json 文件中的规范之前加载它们。

if you want to run jasmine and have it run, you need to add your own boot.js and reporter, and loading them first thing before the spec in the jasmine.json file.

{
  "spec_dir": "spec",
  "spec_files": [
    "boot.js",
    "**/*[sS]pec.js"
  ],
  "helpers": [
    "helpers/**/*.js"
  ],
  "stopSpecOnExpectationFailure": false,
  "random": false
}

这篇关于为什么在`jasmine init`和`jasmine examples`之后运行`jasmine`什么都不做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆