Quantcast
Channel: Node.js Tools for Visual Studio
Viewing all articles
Browse latest Browse all 4630

Commented Issue: TypeScript: Unit tests not discovered by Test Explorer [669]

$
0
0
Hi,

__NTVS version__: NTVS Dev 2014-02-07 VS 2013.msi
__VS Version__: Visual Studio 2013 Ultimate.

When unit tests are created in TypeScript the Test Explorer fails to recognise the tests.

To reproduce

1. Right click on the project >> Add >> New Item >> JavaScript UnitTest file >> UnitTest1.js
2. Open up Test Exporer and ensure the tests are visible.
3. Rename the file to UnitTest2.ts.
4. To set the build action, edit the project XML and set `<TypeScriptCompile Include="UnitTest1.ts" />` [see work item #664](https://nodejstools.codeplex.com/workitem/664)
5. Compile the solution, ensuring UnitTest1.js has been produced.
6. Switch over to Test Explorer - the tests are not visible.

To get the tests back, right click on UnitTest1.js and select "Include in project".

However, this workaround is not viable. In the TypeScript world, the JavaScript files are simply treated as output and should not be included in the project.

Please fix the Test Explorer so that it's able to either

(a). Recognise tests in .ts files, or
(b). Look for .js files not included in the project, but found in the output directory.

Thanks.

Comments: Btw, I prototyped some of this not long ago and was working on a pull request but I haven't quite gotten there yet. I was experimenting with, instead of looking in the project for js files, looking in the OutputDir folder, which is also monitored with a FileSystemWatcher. This seems to work quite well, in the default js case because the OutDir is also the project dir. The only snag I hit was that it would also need you to use the -outdir flag when calling tsc.exe which I couldn't figure out how to hook up yet. If you did that it would theoretically work with any language transpiled to JS assuming it respected the outdir variable.

Viewing all articles
Browse latest Browse all 4630

Trending Articles