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

New Post: A whole bunch of bug fixes on their way...

$
0
0
TypeScript is treated almost identical to JavaScript. The only difference is that at discovery time we switch from the .ts file to the underlying .js file.

At the moment the best documentation is the testframework source code. We'll have better docs by the time we release. For now I can walk you through and answer questions as you have specific ones.
The test discovery is kicked off when a test file changes, is added, or a build event is fired. At that point VS will call us back telling us to report the list of valid test containers. NTVS then goes through the project and identifies which files are test files. We treat each file as a container. Its at this point that we do the trick to switch from the typescript file to the underlying javascript file. We pass that list back to VS and VS subsequently fires an event telling us to discover tests. For each of these files we invoke the "find_tests.js" script which in turn calls into the appropriate TestFramework "find_tests()" function. That will discover each test and send each test back to VS to display in the Test Explorer window.

The TestFrameworks, which by the way you can add your own, are found in our Extension folder
<program files>\Microsoft Visual Studio <vs version>\Common7\IDE\Extensions\Microsoft\Node.js Tools for Visual Studio\1.0\TestFrameworks
If you wanted to add your own framework you simply do two things.
  • Create a new folder under TestFrameworks. The folder name will become the TestFramework name in VS.
  • Add a new .js file with the same name as the folder. This js file needs two exports, find_tests and run_tests.
In your case you are using ExportRunner and can find the discovery logic in exportrunner.js.

Viewing all articles
Browse latest Browse all 4630

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>