How to run Jasmine tests on Node.js from command line

前端 未结 4 1655
梦毁少年i
梦毁少年i 2020-12-14 05:40

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 direc

4条回答
  •  攒了一身酷
    2020-12-14 06:29

    This should get you going quickly:

    1. install Node.js (obviously).
    2. Next install Jasmine. Open a command prompt and run:

      npm install -g jasmine

    3. Next, cd to any directory and set up an example 'project':

      jasmine init
      jasmine examples

    4. 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:

    • https://www.npmjs.com/package/jasmine
    • http://jasmine.github.io/2.2/node.html

提交回复
热议问题