0

I'm working on a Typescript project in Visual Studio (2015 Community edition) build server side unit tests using Mocha.

I however read that NodeJS Tools supports running within the VS Test Runner, and even Typescript unit tests. You have to set the TestFramework property of the file to 'Mocha'. The project I'm working on even already has existing tests which this is set for. However I don't get a dropdown option in the GUI to set it, it's just empty:

Screenshot o' the bug

I'm using NTVS v1.1 (and Typescript 1.7). Am I missing something in my Visual Studio setup? The build type of the test .ts file is also already set to TypeScriptCompile. Perhaps more of a specific VS question than a programming question, but the environment/tools is so programmer's specific that I thought somebody here can help me.

PS Running tests manually each time is driving me crazy, and I bumped into too many problems with using a HTML spec runner which I tried first, because this server side tests (e.g. CommonJS require and import statements that my browser doesn't get) and also because it's TypeScript.

But alternative solutions are also welcome. I'm using grunt and am also experience using Gulp, I'm just hoping for a full solution, not something that'll cost me half a day to script together, debug and document..

Note: I DO get the dropdown to select Mocha Testframework for .js files (after including in VS project), but NOT for .ts files :S.

Bart
  • 5,065
  • 1
  • 35
  • 43

1 Answers1

0

Hmm... pretty silly, but it seems indeed a GUI issue:

You simply have to type Mocha into the property field yourself manually.

In the case of Typescript there doesn't appear a dropdown (e.g. caret) on hoover in the 'TestFramework' field. My expectation was really fixed on the dropdown' experience beause it DOES do that for Javascript files and in so many other fields in the 'Properties' window.

So a short overview of things to do:

  • type yourself and make sure you don't type Mohca or something:).
  • Install Mocha locally
  • Make sure the BuildAction of the .ts file is set to TypeScriptCompile

I'm off fixing other issues, this Typescript is nice, but the tools and language are evolving too fast for the 'Google-based development' I have to rely too really work well :S.

Bart
  • 5,065
  • 1
  • 35
  • 43