Setting up your Angular Environment with end-to-end Testing

0
1852

Angular is back with version 4! Just in case you are confused about what happened to version 3 here’s a quick summary:

The first release of Angular JS was not using semantic version numbering (or better to say not using it correctly) so developers were confused when what appeared to be a patch was in fact a breaking change. The library names were so confusing they skipped version 3 and have now dropped the JS part of the name so now it’s just called Angular and will be versioned semantically henceforth. The good news is that Angular is completely rewritten much better than the first version which was quite difficult to learn, understand and maintain. Angular now comes with a cool command line tool for creating and modifying apps and relies heavily on typescript. Unit and-end-to end testing (e2e) is also baked which is fantastic!

Let’s start by setting up your development environment. For this you will need to:

  1. Download and Install Node.js
    • at least node v6.9.x and npm v3.x.x
  2. Install Angular Globally:
npm install -g @angular/cli

Next generate a new Angular project called my-app in your development directory:

ng new my-app

Enter the project directory and serve it up:

cd my-app
ng serve --open

Run the built in unit tests with Karma

ng test

and the e2e tests with protractor

ng e2e

Angular has never been easier!