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.
For initializing and cleaning your specs, Jasmine provides two global functions, beforeEach() and afterEach() : The beforeEach function is called once before each spec in the suite where it is called. The afterEach function is called once after each spec in the suite where it's called.
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
}
It's a bug in jasmine
https://github.com/jasmine/jasmine-npm/issues/90
Use version 2.4
npm install -g jasmine@~2.4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With