This is a great question, and we hope that it will benefit others in the future, not only with Visual Studio and IIS, but with any project structure that is managed by the parent base that serves the application.
karma.conf.js
First, let's see what we are actually testing. Since karma-jspm has the ability to use babel to fly on the fly, we will test our src , not our level. This is important because we want to make sure that all karma configuration paths all point there, but leave our config.js alone, so system.js knows how to get the files from the very beginning when the application starts.
base path setup
Leave our base path alone. We have our tests and src at wwwroot , but as you mentioned, they are not really our tests. Put them back in the root directory and set basePath: '' so that all paths start from the root.
Jspm settings
Next, let's talk about karma, how to configure our jspm specific parameters, such as files to download and which paths to create. Here we need to remember that the new paths that we define in our config.js , as helpers should be updated in our karma.conf.js, because we are testing src , not dist (which config.js points to). Also, be sure to add wwwroot/ to any files or file paths starting with src so that karma knows where to download them.
jspm: { // Edit this to your needs loadFiles: ['wwwroot/src/**/*.js', '/test/unit/**/*.js'], paths: { '*': '*.js', "services/*": "wwwroot/src/services/*.js" } },
buffer settings>
Finally, we need to update the babel (or traceur) settings so that karma knows which files need to be pre-processed and using which parameters. This is because we are loading from src for testing.
preprocessors: { 'test/**/*.js': ['babel'], 'wwwroot/src/**/*.js': ['babel'] },
Footnote
I would usually refer to a bunch of code samples that could help, but in this case I think it matches the code spam in this answer, but if any changes happen in the future in karma-jspm, it might be worth changing or noting that in the comments so that the answer does not become obsolete.