How do I run Jasmine tests on Node.js from command line? I have installed jasmine-node via npm and written some tests. I want to run tests inside the spec
directory and get results in the terminal, is this possible?
相关问题
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs
- google-drive can't get push notifications
- How to reimport module with ES6 import
- Why is `node.js` dying when called from inside pyt
- How to verify laravel passport api token in node /
相关文章
- node连接远程oracle报错
- How can make folder with Firebase Cloud Functions
- @angular-cli install fails with deprecated request
- node.js modify file data stream?
- How to resolve hostname to an ip address in node j
- Transactionally writing files in Node.js
- Log to node console or debug during webpack build
- Get file created date in node
This should get you going quickly:
Next install Jasmine. Open a command prompt and run:
npm install -g jasmine
Next, cd to any directory and set up an example 'project':
jasmine init
jasmine examples
Now run your unit tests:
jasmine
If your jasmine.json file is somewhere else besides spec/support/jasmine.json, simply run:
jasmine JASMINE_CONFIG_PATH=relative/path/to/your/jasmine.json
For more info see:
Try Karma (formerly Testacular), it is a testing library agnostic test runner done by Angular.js team
http://karma-runner.github.io/0.12/index.html
Jasmine support is well baked.
http://karma-runner.github.io/0.12/intro/how-it-works.html
EDIT
It seems this is no longer the current best answer as the package is unmaintained. Please see the answer below
You can do this
from your test directory
This installs jasmine into ../node_modules/jasmine-node
then
which from my demo does this