Search code examples
visual-studio-2012jasminechutzpah

Visual Studio Test Explorer does not discover jasmine tests


I have jasmine tests that run through the Chutzpah context menu extension (Run JS tests). However they do not get discovered by the Test Explorer and when I right-click and select Run Tests, the output from "Tests" gives me this:

System.ArgumentException: The directory name  is invalid.
   at System.IO.FileSystemWatcher..ctor(String path, String filter)
   at Chutzpah.VS11.EventWatchers.TestFilesUpdateWatcher.AddWatch(String path)
   at Chutzpah.VS2012.TestAdapter.ChutzpahTestContainerDiscoverer.UpdateTestContainersAndFileWatchers(IEnumerable`1 files, Boolean isAdd)
   at Chutzpah.VS2012.TestAdapter.ChutzpahTestContainerDiscoverer.GetTestContainers()
   at Chutzpah.VS2012.TestAdapter.ChutzpahTestContainerDiscoverer.get_TestContainers()
   at Microsoft.VisualStudio.TestWindow.Controller.TestContainerDiscovererExtension.GetSortedContainers(ITestContainerDiscoverer discoverer)
   at Microsoft.VisualStudio.TestWindow.Controller.TestContainerProvider.GetContainersFromDiscoverer(ITestContainerDiscoverer discoverer)
No tests found to run.

Here's my chutzpah.json file also:

{
    "Framework": "jasmine",
    "FrameworkVersion": "2",
    "TestHarnessLocationMode": "SettingsFileAdjacent",
    "References": [
        { "Path": "../../DIB.MemberCatalog/lib/dust/dust-full.js" },
        { "Path": "../../DIB.MemberCatalog/lib/dust-helpers/dust-helpers.js" },
        { "Path": "../../DIB.MemberCatalog/lib/harvey/harvey.js" },
        { "Path": "../../DIB.MemberCatalog/lib/hopscotch/js/hopscotch.js" },
        { "Path": "../../DIB.MemberCatalog/lib/jquery/jquery-1.11.1.js" },
        { "Path": "../../DIB.MemberCatalog/lib/jquery-ui/jquery-ui.js" },
        { "Path": "../../DIB.MemberCatalog/lib/jquery-validate/jquery.validate.js" },
        { "Path": "../../DIB.MemberCatalog/lib/knockout/knockout-3.1.0.js" },
        { "Path": "../../DIB.MemberCatalog/lib/knockout-mapping/knockout.mapping.js" },
        { "Path": "../../DIB.MemberCatalog/lib/knockout-validation/knockout.validation.js" },
        { "Path": "../../DIB.MemberCatalog/lib/lightbox/js/lightbox.js" },
        { "Path": "../../DIB.MemberCatalog/lib/respond/respond.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/jquery.qtip.min.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/json2.min.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/jquery.cookie.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/jquery.hoverIntent.min.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/jquery.lazyload.min.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/changecheck.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/stickytable.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/superalert.js" },
        { "Path": "../../DIB.MemberCatalog/Scripts/core.js" },

        { "Path": "prepare.js" },
        { "Path": "engine.js" }
    ],

    "Tests": [
        { "Path": "tests" }
    ],

    "CodeCoverageIncludes": [],
    "CodeCoverageExcludes": []
}

Solution structure:
DIB.MemberCatalog
  -Testing
    - DIB.MemberCatalog.Tests.JS
      - data
      - lib
        - jasmine-2.0.0
          - (jasmine files, boot, console, jasmine)
      - tests
        - testfiles.js
      - chutzpah.json
  -DIB.MemberCatalog
    - (more...)

I've scoured the internet and can't find a solution.


Solution

  • Solved by changing my test project name from DIB.MemberCatalog.Tests.JS to DIB.MemberCatalog.Tests.Client. Confusion happens when the project has the javascript file extension at the end of the project name.