Skip to content

Commit

Permalink
Merge pull request #9 from ignatvilesov/dev/test-coverage
Browse files Browse the repository at this point in the history
Unit tests:  Add an ability to measure code coverage of DataViewUtils
  • Loading branch information
AviSander committed Jan 10, 2017
2 parents 724bc8d + 84192c2 commit ed96da2
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
*.log
/coverage
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ install:
script:
- npm run lint
- npm run test
after_success:
- node node_modules/coveralls/bin/coveralls.js < coverage/lcov.info
notifications:
email: false
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Microsoft Power BI visuals DataViewUtils
[![Build Status](https://travis-ci.org/Microsoft/powerbi-visuals-utils-dataviewutils.svg?branch=master)](https://travis-ci.org/Microsoft/powerbi-visuals-utils-dataviewutils) [![npm version](https://img.shields.io/npm/v/powerbi-visuals-utils-dataviewutils.svg)](https://www.npmjs.com/package/powerbi-visuals-utils-dataviewutils) [![npm](https://img.shields.io/npm/dm/powerbi-visuals-utils-dataviewutils.svg)](https://www.npmjs.com/package/powerbi-visuals-utils-dataviewutils)
[![Build Status](https://travis-ci.org/Microsoft/powerbi-visuals-utils-dataviewutils.svg?branch=master)](https://travis-ci.org/Microsoft/powerbi-visuals-utils-dataviewutils) [![Coverage Status](https://coveralls.io/repos/github/Microsoft/powerbi-visuals-utils-dataviewutils/badge.svg?branch=master)](https://coveralls.io/github/Microsoft/powerbi-visuals-utils-dataviewutils?branch=master) [![npm version](https://img.shields.io/npm/v/powerbi-visuals-utils-dataviewutils.svg)](https://www.npmjs.com/package/powerbi-visuals-utils-dataviewutils) [![npm](https://img.shields.io/npm/dm/powerbi-visuals-utils-dataviewutils.svg)](https://www.npmjs.com/package/powerbi-visuals-utils-dataviewutils)

> DataViewUtils is a set of functions and classes in order to simplify parsing of the DataView object for Power BI custom visuals
Expand Down
40 changes: 31 additions & 9 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@

'use strict';

const recursivePathToTests = 'test/**/*.ts'
, indexFile = 'lib/index.js';
const testRecursivePath = 'test/**/*.ts'
, srcOriginalRecursivePath = 'src/**/*.ts'
, srcRecursivePath = 'lib/**/*.js'
, coverageFolder = 'coverage';

module.exports = (config) => {
let browsers = [];
Expand All @@ -48,25 +50,45 @@ module.exports = (config) => {
browsers: browsers,
colors: true,
frameworks: ['jasmine'],
reporters: ['progress'],
reporters: [
'progress',
'coverage',
'karma-remap-istanbul'
],
singleRun: true,
files: [
'node_modules/lodash/lodash.min.js',
indexFile,
recursivePathToTests
srcRecursivePath,
testRecursivePath,
{
pattern: srcOriginalRecursivePath,
included: false,
served: true
}
],
preprocessors: {
[recursivePathToTests]: ['typescript']
[testRecursivePath]: ['typescript'],
[srcRecursivePath]: ['sourcemap', 'coverage']
},
typescriptPreprocessor: {
options: {
sourceMap: false,
target: 'ES5',
removeComments: false,
concatenateOutput: false
},
transformPath: (path) => {
return path.replace(/\.ts$/, '.js');
}
},
coverageReporter: {
dir: coverageFolder,
reporters: [
{ type: 'html' },
{ type: 'lcov' }
]
},
remapIstanbulReporter: {
reports: {
lcovonly: coverageFolder + '/lcov.info',
html: coverageFolder
}
}
});
Expand Down
1 change: 1 addition & 0 deletions lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@
"devDependencies": {
"@types/jasmine": "2.5.37",
"@types/lodash": "4.14.36",
"coveralls": "2.11.15",
"jasmine": "2.5.2",
"karma": "1.3.0",
"karma-chrome-launcher": "2.0.0",
"karma-coverage": "1.1.1",
"karma-jasmine": "1.0.2",
"karma-remap-istanbul": "0.4.0",
"karma-sourcemap-loader": "0.3.7",
"karma-typescript-preprocessor": "0.3.0",
"powerbi-visuals-tools": "1.2.0",
"tslint": "3.15.1",
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"experimentalDecorators": true,
"target": "ES5",
"declaration": true,
"outFile": "./lib/index.js"
"outFile": "./lib/index.js",
"sourceMap": true
},
"files": [
"node_modules/@types/lodash/index.d.ts",
Expand All @@ -15,4 +16,4 @@
"src/converterHelper.ts",
"src/dataViewObjectsParser.ts"
]
}
}

0 comments on commit ed96da2

Please sign in to comment.