0

I am trying to setup Jasmine in IntelliJ IDEA with the jasmine-jstd-adapter plugin for JSTestDriver.

  • JSTD Plugin is installed
  • jasmine was npm-installed globally (so it resides in %APPDATA%\npm\node_modules\jasmine)
  • jasmine.js file from the npm install was added to JS libraries in the IDEA settings with global scope.
  • I have the following package structure inside IDEA:

    -myProject\
    
    -- .idea\ {...}
    
    -- myTest.js
    
    -- myTest.spec.js
    
    -- test.jstd
    
    -External Libraries\
    
    -- jasmine\
    
    --- jasmine.js
    

Now I have no idea how to structure my config file. Currently it looks like this, because the Jetbrains help did tell me so:

load:
  - "lib/jasmine/jasmine.js"
  - "lib/jasmine-jstd-adapter/JasmineAdapter.js"
  - "*.js"

test:
  - "*.spec .js"

But it fails to open the jasmine scripts, when executing the JSTD run configuration:

Cannot read C:\Users\danie\Documents\ExercismProjects\javascript\simple-cipher\lib\jasmine\jasmine.js derived from lib/jasmine/jasmine.js
Cannot read C:\Users\danie\Documents\ExercismProjects\javascript\simple-cipher\lib\jasmine-jstd-adapter\JasmineAdapter.js derived from lib/jasmine-jstd-adapter/JasmineAdapter.js

My questions:

  1. Don't I have to add the jasmine-jstd-adapter.js as well somewhere? Where do I find it?
  2. How do I load the library files? They are obviously not in \lib\, because there is no lib folder. So how do I refer to the "External Libraries"?
  3. What else am I missing?
Anthon
  • 69,918
  • 32
  • 186
  • 246
Vankog
  • 557
  • 1
  • 9
  • 16

1 Answers1

1

1. you can use Add Jasmine JsTestDriver adapter inspection to download the adapter:

  • enable Add JsTestDriver assertion framework support and Add Jasmine JsTestDriver adapterin Settings | Editor | Inspections JavaScript | JsTestDriver.
  • re-open the project - you will see prompts to download the adapter:

enter image description here

  • hit Alt+Enter, specify the folder to download jasmine.js and jasmineAdapter.js to, press Add

    2. There is no way to use IDE External libraries here - the latter are only used by the IDE itself for code completion/type hinting and are not available to JsTestDriver test runner. Library files have to be placed in your project and referenced in "load" section using URLs relative to configuration file. Note that http urls are also supported - see https://code.google.com/archive/p/js-test-driver/wikis/ConfigurationFile.wiki

Note that WebStorm will download the library for you if you follow the steps described above

lena
  • 90,154
  • 11
  • 145
  • 150