The basic scaffolding structue for this app is taken from angular2 Qucik start angular.io quickstart, and John papa angular basics.
Unit test and E2E are are extended with testing support form basic scaffolding structure and jasime and karma reporters spec reporters.
Install the npm packages described in the package.json
and verify that it works:
Attention Windows Developers: You must run all of these commands in administrator mode.
npm install
npm start
If the
typings
folder doesn't show up afternpm install
please install them manually with:
npm run typings -- install
The npm start
command first compiles the application,
then simultaneously re-compiles and runs the lite-server
.
Both the compiler and the server watch for file changes.
Shut it down manually with Ctrl-C.
Useful commands in npm scripts defined in the package.json
:
npm start
- runs the compiler and a server at the same time, both in "watch mode".npm run tsc
- runs the TypeScript compiler once.npm run tsc:w
- runs the TypeScript compiler in watch mode; the process keeps running, awaiting changes to TypeScript files and re-compiling when it sees them.npm run lite
- runs the lite-server, a light-weight, static file server, written and maintained by John Papa and Christopher Martin with excellent support for Angular apps that use routing.npm run typings
- runs the typings tool.npm run postinstall
- called by npm automatically after it successfully completes package installation. This script installs the TypeScript definition files this app requires. Here are the test related scripts:npm test
- compiles, runs and watches the karma unit testsnpm run e2e
- run protractor e2e tests, written in JavaScript (*e2e-spec.js)[*make sure lite server is running for the e2e to work.]
TypeScript unit-tests are usually in the app
folder. Their filenames must end in .spec
.
Look for the example app/components/app.component.spec.ts
.
Add more .spec.ts
files as you wish; we configured karma to find them.
Run it with npm test
That command first compiles the application, then simultaneously re-compiles and runs the karma test-runner. Both the compiler and the karma watch for (different) file changes.
Shut it down manually with Ctrl-C.
E2E tests are in the e2e
directory, side by side with the app
folder.
Their filenames must end in .e2e-spec.ts
.
Look for the example e2e/app.e2e-spec.ts
.
Add more .e2e-spec.js
files as you wish (although one usually suffices for small projects);
protractor is configured to find them.
Thereafter, run them with npm run e2e
.
That command first compiles, then simultaneously starts the Http-Server at localhost:3000
and launches protractor.
Shut it down manually with Ctrl-C.
alias npm-exec='PATH=$(npm bin):$PATH'