• Blogs (9)
    • šŸ“± 236 - 992 - 3846

      šŸ“§ jxjwilliam@gmail.com

    • Version: ā€šŸš€ 1.1.0
  • Configure Karma+Jasmine testing in Webstorm

    Blogs20142014-08-28


    Configure Karma+Jasmine testing in Webstorm

    The following is my steps to do karma test/debug in Webstorm

    • 1. make sure karma-jasmine module is installed:
      $ npm list karma-jasmine | npm install karma-jasmine —save-dev
    • 2. make sure install karma-chrome-launcher:
      $ npm install karma-chrome-launcher —save
    • 3. generate karm.con.js:
      $ karma init
    • 4. Webstorm + Karma-Jamine

      (1) In Webstorm: ctrl+shift+a, select JavaScript
      
      (2) JavaScript -> Libraries -> Add:
      Name: Karma-Jasmine
      Add...->Attach Files: node_moduleskarma-jasminelibjasmine.js
      
      (3) Manage Scopes: 'test' folder.
      
      (4) Then in karma.conf.js:
              files: [
                  'test/spec/*Spec.js'
              ],
      
      (5) // option, if using grunt:
      in Gruntfile.js:
          karma: {
              unit: {
                  configFile: 'karma.conf.js',
                  singleRun: true
              }
          }
      
      (6) //option: set CHROME_BIN if not exist.
      SET CHROME_BIN="C:Program Files (x86)GoogleChromeApplicationchrome.exe"
      
      (7) Run->Debug 'karma.conf.js'.

    It should work.Or use command-line:

    $ karma start

    It also should work.