Angular JS 1.5 - ES6 Module Unit testing and Karma Integration testing seed by @tomastrajan ![Build Status](https://camo.githubusercontent.com/51c8f50c9b6d7f84e2f2c657c1033f61d58564d8ac9773e1e643b8d69a6b78c5/68747470733a2f2f7472617669732d63692e6f72672f746f6d61737472616a616e2f616e67756c61722d6a732d6573362d74657374696e672d6578616d706c652e7376673f6272616e63683d6d6173746572)
Great seed for enterprise projects with heavy focus on unit and integration testing.
This repository contains two releases:
1.4.0
- for Angular JS 1.4 and lower (uses Component Pattern for Angular JS)1.5.0
- for Angular JS 1.5 and above which supports native.componet(name, options)
API
- original blog post describing Proper testing of Angular JS 1.X applications with ES6 modules
- demo project with examples of mocha unit & karma integration tests
- presentation about the concepts used in this repository
- video from Angular JS Meetup Zurich
- Clone repository
git clone https://github.com/tomastrajan/angular-js-es6-testing-example.git
- Enter project directory
cd angular-js-es6-testing-example
- Install dependencies
npm i
ornpm install
All scripts are run with npm run [script]
, for example: npm run test
.
-
start
- start development server, try it by openinghttps://localhost:8081/webpack-dev-server/index.html
-
build
- create dev build, checkbuild
directory -
dist
- create production build, checkdist
directory -
server_build
- serve content frombuild
directory -
server_dist
- serve content fromdist
directory -
lint
- lint code (with ESLint) -
mocha
- run all unit tests (with Mocha) -
watch
- run and watch all unit tests (with Mocha) -
karma
- run all integration tests (with Karma / Jasmine) -
test
- lint code and run all tests (with Mocha and Karma) -
ci
- for Travis CI
For more detailed info about tests check the original blog post.
*.test.js
- mocha unit tests*.integration.test.js
- mocha integration tests (manual)*.spec.js
- karma integration tests (spin up Angular JS app context)