Skip to content

Commit e7830a1

Browse files
committed
Merge remote-tracking branch 'upstream/master'
Conflicts: tests/karma.conf.js tests/unit/iggrid/grid.spec.ts
2 parents 0d22525 + 4c31075 commit e7830a1

File tree

7 files changed

+99
-121
lines changed

7 files changed

+99
-121
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ before_install:
66
- export DISPLAY=:99.0
77
- sh -e /etc/init.d/xvfb start
88
- sleep 3
9+
script:
10+
- npm run test
11+
- cat ./coverage/lcov.info | coveralls

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#Ignite UI components for Angular 2
2+
3+
[![NPM version](https://img.shields.io/npm/v/igniteui-angular2.svg?style=flat)](https://www.npmjs.com/package/igniteui-angular2)
24
[![Build Status](https://travis-ci.org/IgniteUI/igniteui-angular2.svg?branch=master)](https://travis-ci.org/IgniteUI/igniteui-angular2)
5+
[![Coverage Status](https://coveralls.io/repos/github/IgniteUI/igniteui-angular2/badge.svg?branch=master)](https://coveralls.io/github/IgniteUI/igniteui-angular2?branch=master)
36

47
Use the components found in `src\igniteui.angular2.ts` to use [Ignite UI](http://igniteui.com) controls in [Angular 2](https://angular.io/) applications. [Work with the running samples here](http://igniteui.github.io/igniteui-angular2).
58

@@ -176,6 +179,19 @@ The following controls currently support two-way data binding:
176179
5. igEditors
177180
6. igTree
178181

182+
## Running tests
183+
184+
The command for running the tests is:
185+
186+
npm test
187+
188+
After that, if all tests successfully passed a code coverage for the `igniteui.angular2.ts` filse will be generated under the `./coverage` folder.
189+
190+
To see the code coverage you can open one of the html files under `./coverage/html-report/src`.
191+
192+
**Note:** The code coverage is actually being generated on the `igniteui.angular2.js` file (comes from compilation of the source .ts file). That coverage is saved under the `coverage/karma-tmp` folder.
193+
Since we need the code coverage of the `igniteui.angular2.js` file itself, we use the remap-istanbul module to remap the report from the .js file to the .ts file and save it under the `coverage/html-report` and `coverage/lcov.info`.
194+
179195
---------------------------------------
180196

181197
##What is Ignite UI?

package.json

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
{
22
"name": "igniteui-angular2",
33
"version": "1.0.0",
4-
"scripts": {
5-
"postinstall": "npm run typings && npm prune",
6-
"start": "npm run lite",
7-
"lite": "lite-server",
8-
"pretest": "npm run build",
9-
"build": "node node_modules/typescript/bin/tsc && npm run prepare-dist",
10-
"watch": "node node_modules/typescript/bin/tsc -w",
11-
"typings": "node node_modules/typings/dist/bin.js install",
12-
"test": "karma start tests/karma.conf.js",
13-
"prepare-dist": "cp src/igniteui.angular2.js dist/npm/ && cp src/igniteui.d.ts dist/npm/ && cp src/jquery.d.ts dist/npm/"
14-
},
154
"license": "MIT",
165
"repository": {
176
"type": "git",
@@ -32,8 +21,30 @@
3221
"karma-chrome-launcher": "^0.2.2",
3322
"karma-jasmine": "^0.2.2",
3423
"karma-junit-reporter": "^0.4.2",
24+
"karma-coverage": "",
25+
"karma-remap-istanbul": "",
3526
"lite-server": "^2.2.0",
3627
"typescript": "^1.8.9",
37-
"typings": "^0.7.12"
28+
"typings": "^0.7.12",
29+
"coveralls": "^2.11.9"
30+
},
31+
"scripts": {
32+
"postinstall": "npm run typings && npm prune",
33+
"typings": "node node_modules/typings/dist/bin.js install",
34+
35+
"start": "npm run lite",
36+
"lite": "lite-server",
37+
38+
"watch": "node node_modules/typescript/bin/tsc -w",
39+
"build": "node node_modules/typescript/bin/tsc && npm run prepare-dist",
40+
"prepare-dist": "cp src/igniteui.angular2.js dist/npm/ && cp src/igniteui.d.ts dist/npm/ && cp src/jquery.d.ts dist/npm/",
41+
42+
"pretest": "npm run build",
43+
"test": "karma start tests/karma.conf.js && npm run remap-istanbul",
44+
45+
"remap-istanbul": "npm run copy-coverage-report && npm run remap-istanbul-html && npm run remap-istanbul-lcov",
46+
"remap-istanbul-html": "remap-istanbul -i coverage/karma-tmp/coverage.json -o coverage/html-report -t html",
47+
"remap-istanbul-lcov": "remap-istanbul -i coverage/karma-tmp/coverage.json -o coverage/lcov.info -t lcovonly",
48+
"copy-coverage-report": "cp coverage/karma-tmp/**/coverage*.json coverage/karma-tmp/"
3849
}
3950
}

tests/karma-test-shim.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ System.config({
2525
paths: {
2626
'angular2/*': 'node_modules/angular2/*.js',
2727
'rxjs/*': 'node_modules/rxjs/*.js'
28+
},
29+
meta: {
30+
'src/*': {
31+
format: 'register'
32+
}
2833
}
2934
});
3035

tests/karma.conf.js

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module.exports = function(config){
2-
var cfg = {
3-
basePath : '../',
2+
var cfg = {
3+
basePath : "../",
4+
5+
frameworks: ["jasmine"],
46

57
files : [
68

@@ -10,65 +12,70 @@ module.exports = function(config){
1012
"http://cdn-na.infragistics.com/igniteui/latest/js/infragistics.lob.js",
1113
"http://cdn-na.infragistics.com/igniteui/latest/js/infragistics.dv.js",
1214
"https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.js",
13-
15+
1416
// IE required polyfills, in this exact order
1517
"node_modules/es6-shim/es6-shim.min.js",
1618
"node_modules/systemjs/dist/system-polyfills.js",
17-
19+
1820
"node_modules/angular2/bundles/angular2-polyfills.js",
1921
"node_modules/systemjs/dist/system.src.js",
2022
"node_modules/rxjs/bundles/Rx.js",
2123
"node_modules/angular2/bundles/angular2.dev.js",
22-
'tests/karma-test-shim.js',
23-
24+
25+
"tests/karma-test-shim.js",
26+
2427
{ pattern: 'samples/data/*.js', included: false, watched: false },
25-
{ pattern: 'node_modules/angular2/**/*.js', included: false, watched: false },
26-
{ pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false },
27-
{ pattern: 'src/**/*', included: false, watched: false },
28+
{ pattern: "node_modules/angular2/**/*.js", included: false, watched: false },
29+
{ pattern: "node_modules/rxjs/**/*.js", included: false, watched: false },
2830

29-
// spec files need to be loaded in the shim file IN CONTEXT of the main module, don't include:
30-
{ pattern: 'tests/unit/**/*.js', included: false, watched: true }
31-
32-
],
31+
// paths loaded via module imports
32+
{pattern: "src/*.js", included: false, watched: true},
3333

34+
// spec files need to be loaded in the shim file IN CONTEXT of the main module, don't include:
35+
{ pattern: "tests/unit/**/*.spec.js", included: false, watched: true }
36+
],
37+
3438
// list of files to exclude
3539
exclude: [
36-
'node_modules/angular2/**/*spec.js'
40+
"node_modules/angular2/**/*spec.js"
3741
],
3842

39-
autoWatch : true,
40-
41-
frameworks: ['jasmine'],
43+
autoWatch : true,
4244

43-
browsers : ['Chrome'],
45+
browsers : ["Chrome"],
4446

45-
singleRun: true,
47+
singleRun: true,
4648

47-
customLaunchers: {
48-
Chrome_travis_ci: {
49-
base: "Chrome",
50-
flags: ["--no-sandbox"]
51-
}
52-
},
49+
customLaunchers: {
50+
Chrome_travis_ci: {
51+
base: "Chrome",
52+
flags: ["--no-sandbox"]
53+
}
54+
},
5355

54-
plugins : [
55-
'karma-chrome-launcher',
56-
'karma-jasmine'
57-
,
58-
'karma-junit-reporter'
56+
plugins : [
57+
"karma-chrome-launcher",
58+
"karma-jasmine",
59+
"karma-junit-reporter",
60+
"karma-coverage"
5961
],
60-
61-
//reporters: ['junit'],
62+
63+
reporters: ["progress", "coverage"],
64+
65+
preprocessors: {
66+
"src/igniteui.angular2.js": ["coverage"]
67+
},
68+
69+
coverageReporter: {
70+
reporters:[
71+
{ type: "lcov", dir:"coverage/karma-tmp/" },
72+
{ type: "json", dir:"coverage/karma-tmp", file: "coverage.json" }
73+
],
74+
}
75+
};
6276

63-
junitReporter : {
64-
outputFile: 'test_out/unit.xml',
65-
suite: 'unit'
66-
}
67-
68-
};
69-
70-
if (process.env.TRAVIS) {
71-
cfg.browsers = ["Chrome_travis_ci"];
72-
}
73-
config.set(cfg);
77+
if (process.env.TRAVIS) {
78+
cfg.browsers = ["Chrome_travis_ci"];
79+
}
80+
config.set(cfg);
7481
};

tests/unit/iggrid/grid.spec.ts

Lines changed: 0 additions & 65 deletions
This file was deleted.

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"exclude": [
1313
"node_modules",
1414
"typings/browser",
15-
"typings/browser.d.ts"
15+
"typings/browser.d.ts",
16+
"dist/npm/"
1617
]
1718
}

0 commit comments

Comments
 (0)