I have been searching for a way to test Typescript in Visual Studio for 2 days now. It seems that there is an issue in doing this. I have tried using different frameworks i just cannot get this to work in a separate project. Does anyone have any suggestions on how to get this to work in a separate project? Do I need to create a web interface where this can be run?
Thank you.
Most TypeScript unit testing frameworks run on the command line.
To integrate these with Visual Studio, you can use a Task Runner like Gulp.
Once you have your gulpfile.js
set up to run the tests, it will be visible in the Visual Studio "Task Runner Explorer" window CTRL
+ ALT
+ Backspace
.
You can set a task to run whenever you build your solution by right-clicking it in Task Runner Explorer and selecting "Bindings -> After Build".
Example Gulp file for Karma:
/// <binding AfterBuild='test' />
var gulp = require('gulp');
var Server = require('karma').Server;
gulp.task('test', function (done) {
new Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done).start();
});