mahdi amiri
mahdi amiri

Reputation: 33

How to run jasmine-node in WebStorm IDE

I've installed nodejs and jasmine-node and it runs in command line.

Configuration of WebStorm Runner:

  1. Node parameters: jasmine-node --config endpoint ServerAddress:8083
  2. Working directory: G:\NPWorkDir\frisby
  3. JavaScript file: src\protocol\find_spec.js

WebStorm Terminal:

"C:\Program Files\JetBrains\WebStorm\bin\runnerw.exe" "G:\Program 
Files\nodejs\node.exe" jasmine-node --config endpoint ServerAddress:8083 
G:\NPWorkDir\frisby\src\
protocol\find_spec.js

module.js:471
throw err;
^

Error: Cannot find module 'G:\NPWorkDir\tester-frisbys\jasmine-node'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3

Process finished with exit code 1

Upvotes: 3

Views: 974

Answers (3)

Galdor
Galdor

Reputation: 1975

My answer uses linux instead of windows pathnames!

I would recommend jasmine instead of jasmine-node, it seems to be more actual. Create the configuration with

./node_modules/.bin/jasmine init

edit jasmine.json if necessary.

I would create a npm script in package.json as:

"scripts": {
  "test": "node_modules/.bin/jasmine",
  ...
},

and define it in Webstorm as npm script; command: run, script: test

Upvotes: 0

mahdi amiri
mahdi amiri

Reputation: 33

Full configuration to run jsmine-node:

  1. Install jasmine node with -save parameter:

    npm install jasmine-node -save

  2. Configuration WebStorm runner with this parameters:

    • javaScript file -home directiory-\AppData\Roaming\npm\node_modules\jasmine-node\lib\jasmine-node\cli.js
    • Application parameters: //path to your test files

Upvotes: 0

lena
lena

Reputation: 93728

you have to specify node_modules\jasmine-node\bin\jasmine-node as a JavaScript file, passing --config option and you .js file as Application parameters, like;

enter image description here

Upvotes: 3

Related Questions