punkrockbuddyholly
punkrockbuddyholly

Reputation: 9794

Why does running `jasmine` after `jasmine init` and `jasmine examples` do nothing?

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

Running jasmine -v gives me

jasmine v2.5.0
jasmine-core v2.5.0

I have then, as per the docs, run

jasmine init
jasmine examples

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

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.

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.

Upvotes: 10

Views: 1308

Answers (2)

Stefano Borini
Stefano Borini

Reputation: 143785

It's a bug in jasmine

https://github.com/jasmine/jasmine-npm/issues/90

Use version 2.4

npm install -g jasmine@~2.4

Upvotes: 2

Bamieh
Bamieh

Reputation: 10906

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.)

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

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.

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

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
}

Upvotes: 3

Related Questions