Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gabel/karma-webpack-example
Karma + Webpack + Mocha + Chai + Istanbul
https://github.com/gabel/karma-webpack-example
chai coverage istanbul javascript karma-webpack mocha phantomjs testing webpack
Last synced: 28 days ago
JSON representation
Karma + Webpack + Mocha + Chai + Istanbul
- Host: GitHub
- URL: https://github.com/gabel/karma-webpack-example
- Owner: gabel
- License: mit
- Created: 2015-04-09T08:04:25.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-03-04T06:37:18.000Z (over 4 years ago)
- Last Synced: 2024-10-01T05:52:04.427Z (about 1 month ago)
- Topics: chai, coverage, istanbul, javascript, karma-webpack, mocha, phantomjs, testing, webpack
- Language: JavaScript
- Homepage:
- Size: 55.7 KB
- Stars: 87
- Watchers: 4
- Forks: 30
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/gabel/karma-webpack-example.svg?branch=master)](https://travis-ci.org/gabel/karma-webpack-example)
# karma-webpack-example
Karma + Webpack + Mocha + Chai + Istanbul
**Hint:** This example still shows a valid approach but getting outdated. Please have a look at https://jestjs.io/ a testing framework including istanbul coverage reporter.
## Installation
```npm install```
## Run
```
npm test
```Use `npm test -- --no-single-run` to keep karma running. It will watch any changes on the test files and rerun instantly.
Output
```
$ npm test> [email protected] test /Users/d060690/karma-webpack-example
> node ./node_modules/karma/bin/karma start --single-run --browsers PhantomJS# ...
03 02 2017 08:31:17.038:INFO [karma]: Karma v1.4.1 server started at http://0.0.0.0:9876/
03 02 2017 08:31:17.044:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
03 02 2017 08:31:17.067:INFO [launcher]: Starting browser PhantomJS
03 02 2017 08:31:18.045:INFO [PhantomJS 2.1.1 (Mac OS X 0.0.0)]: Connected on socket yME3wmuxdm0t5GHIAAAA with id 92073047hexColorLuminance
✓ should return a luminanced color
✓ should change the background of an elementPhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 2 of 2 SUCCESS (0.02 secs / 0.002 secs)
TOTAL: 2 SUCCESS-----------------------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
-----------------------|----------|----------|----------|----------|----------------|
Example/ | 83.33 | 50 | 100 | 83.33 | |
hexColorLuminance.js | 83.33 | 50 | 100 | 83.33 | 10,14,17 |
-----------------------|----------|----------|----------|----------|----------------|
All files | 83.33 | 50 | 100 | 83.33 | |
-----------------------|----------|----------|----------|----------|----------------|=============================== Coverage summary ===============================
Statements : 83.33% ( 15/18 )
Branches : 50% ( 5/10 )
Functions : 100% ( 3/3 )
Lines : 83.33% ( 15/18 )
================================================================================
```## Gulp
added usage in a gulp scenario
try it via "npm run test-gulp" or simply "gulp" in the
projects directory if you have gulp installed globally## Istanbul Coverage
![Istanbul-HTML-Coverage](docs/assets/istanbul-coverage-html.png)