Skip to content

juliemr/ngconf-2016-zones

Repository files navigation

Intro

Examples from ngConf 2016, Testing your Tasks.

Talk Video

Presentation Slides

For a full-service starter application with testing setup, try angular-cli.

Software Prerequisites

In order to run this seed, the following software is required

Git

See Setting Up Git from the GitHub guides.

Node.js and npm

Node.js and Node's package manager, npm, are used for installing dependencies, running the build steps, and running tests.

Getting Started

Begin by cloning the repository.

Use npm to get dependencies:

npm install

Take a look at the src folder. All application and test code, as well as some configuration files, are in here. The app folder contains the actual application code, written in TypeScript, as well as associated template and css files. The test folder contains the example unit tests.

The Build/Test Pipeline

To be as minimal as possible, this repo uses npm scripts for all building and testing steps. You can see exactly what the scripts do in package.json. A more complex application would probably consider using a tool such as grunt or gulp to manage development pipelines.

Build

The build step invokes the TypeScript compiler to create ES5 javascript files and source maps from the .ts files. Run with:

npm run build

You can examine the configuration for the TypeScript compiler in tsconfig.json. The generated files are output in the built/ folder.

To remove all generated files, run:

npm run clean.

Watch

The watch step can be run with:

npm run watch

This runs the TypeScript compiler with the additional --watch flag, which sets up a persistent process that recompiles new .js files whenever a .ts file changes.

Run this process indefinitely in a different tab or in the background, since the following commands will use it.

Serve

To see the app, run

npm run serve

and navigate to localhost:9090/built/.

Zone examples are at localhost:9090/zone_egs/.

Test

We use Karma with the Jasmine test framework to run unit tests. Try them with

npm run test

This will start a persistent process which will re-run tests whenever the .js compiled files are changed. If you have the watch process running, that will trigger the tests to run whenever you change the .ts source files.

You can see the Karma configuration at karma.conf.js.

About

Examples for ngconf 2016 talk on Testing, Tasks, and Zones

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published