Wallaby js in Visual Studio : tests in different folder

503 Views Asked by At

I am using a wallaby.js with jasmine for FE unit tests. I would like to separate the Tests from Productive Code in such a way, that i create two projects - A and A_Test. All productive code is in A and all test code is in A_Test.

The problem with wallaby is, that i can not make it work for such a configuration since it seems to not support the relative '../../' notation.

My example json configuration:

    {
  "files": [
    "../../A/src/*.js"  <--- This part doesn't work
  ],

  "tests": [
    "test/*Spec.js"
  ],
  "testFramework": "[email protected]"
}

(It seems to be wallabys fault since my test in jasmine works fine with ../ paths, also a full path doesn't work)

Do you know if it is possible to support such a structure?

Thanks!

1

There are 1 best solutions below

0
On

I added a wallaby.json file to the visual studio solution items. This was physically placed just outside the folders of 2 projects. One called Ckm and the other called CkmClientUnitTest.

The following wallby.json resulted in running the javascript test from a separate project, but including the sut javascript's from the main project. jquery is included in the tests from the main project.

{
  "files": [
    "style/calculator.css",
    {
      "pattern": "Ckm/wwwroot/lib/jquery/dist/jquery.js",
      "instrument": false
    },
    {
      "pattern": "Ckm/wwwroot/Mashup/lib/*.js"
    }
  ],
  "tests": [
    "Ckm.ClientUnitTest/wwwroot/Mashup/lib/*TestJasmine.js"
  ],
  "testFramework": "[email protected]"
}