Tuesday 30 May 2017

How to add karma/jasmine to this minimal Angular2 app in VS Code

I am setting up Angular2 in Visual Studio Code using this tutorial, and specifically the code in this GitHub repository. I notice that the system.config.js for the sample contains the following testing mappings:

  // angular testing umd bundles
  '@angular/core/testing': 'npm:@angular/core/bundles/core-testing.umd.js',
  '@angular/common/testing': 'npm:@angular/common/bundles/common-testing.umd.js',
  '@angular/compiler/testing': 'npm:@angular/compiler/bundles/compiler-testing.umd.js',
  '@angular/platform-browser/testing': 'npm:@angular/platform-browser/bundles/platform-browser-testing.umd.js',
  '@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js',
  '@angular/http/testing': 'npm:@angular/http/bundles/http-testing.umd.js',
  '@angular/router/testing': 'npm:@angular/router/bundles/router-testing.umd.js',
  '@angular/forms/testing': 'npm:@angular/forms/bundles/forms-testing.umd.js', 

Karma, Jasmine, and Protractor are visibly missing.

What specific steps are required in order to add karma with Jasmine to this sample app?

I am deliberately NOT asking about Protractor so that this question can remain narrowly focused.

Also, I know that there is an Angular QuickStart with testing configured, but I want the bare minimum app working with VS Code as in the links above. The minimal version enables people to learn how things actually work by building things up piece by piece.

There are many tutorials about this, including a book that I purchased, but they all offer much more complicated examples. I am asking for the minimum way of adding karma/jasmine and running a minimal test in the sample app linked above.



via CodeMed

No comments:

Post a Comment