This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from mediamonks/feature/remap-istanbul
Add sourcemap support for coverage by using remap-istanbul
- Loading branch information
Showing
10 changed files
with
192 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"target": "es5", | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"preserveConstEnums": true, | ||
"noImplicitAny": false, | ||
"removeComments": false, | ||
"noEmitHelpers": true, | ||
"sourceMap": false, | ||
"inlineSourceMap": true | ||
}, | ||
"exclude": [ | ||
"node_modules" | ||
], | ||
"filesGlob": [ | ||
"../src/**/*.ts", | ||
"../typings/index.d.ts" | ||
], | ||
"awesomeTypescriptLoaderOptions": { | ||
"resolveGlobs": false, | ||
"forkChecker": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/*eslint-disable */ | ||
var webpack = require('webpack'); | ||
var path = require('path'); | ||
|
||
module.exports = function() | ||
{ | ||
return { | ||
/** | ||
* Inline source maps, generated by TypeScript compiler, will be used. | ||
*/ | ||
devtool: 'inline-source-map', | ||
|
||
resolve: { | ||
extensions: ['', '.ts', '.js'] | ||
}, | ||
// entry is the "main" source file we want to include/import | ||
entry: './test/index.ts', | ||
|
||
verbose: true, | ||
|
||
module: { | ||
loaders: [ | ||
/** | ||
* Unlike ts-loader, awesome-typescript-loader doesn't allow to override TS compiler options | ||
* in query params. We use separate `tsconfig.test.json` file, which only differs in one thing: | ||
* inline source maps. They are used for code coverage report. | ||
* | ||
* See project repository for details / configuration reference: | ||
* https://github.com/s-panferov/awesome-typescript-loader | ||
*/ | ||
{ | ||
test: /\.ts$/, | ||
exclude: /node_modules/, | ||
loader: 'awesome-typescript-loader', | ||
query: { | ||
tsconfig: 'config/tsconfig.test.json' | ||
} | ||
} | ||
], | ||
postLoaders: [ | ||
/** | ||
* Instruments TS source files for subsequent code coverage. | ||
* See https://github.com/deepsweet/istanbul-instrumenter-loader | ||
*/ | ||
{ | ||
test: /\.ts$/, | ||
loader: 'istanbul-instrumenter-loader', | ||
exclude: [ | ||
/node_modules/, | ||
/test/, | ||
/Spec\.ts$/ | ||
] | ||
} | ||
] | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Test file for code coverage checks | ||
* This file is not covered by any tests, but should show up in code coverage | ||
* results as a very low coverage percentage. | ||
* | ||
* @namespace example | ||
* @class Dummy | ||
* @constructor | ||
*/ | ||
export default class Dummy | ||
{ | ||
/** | ||
* Returns a value! | ||
* | ||
* @method foo | ||
* @param {string} str The input string | ||
* @returns {string} | ||
*/ | ||
public foo(str?:string):string | ||
{ | ||
if (typeof str == 'undefined') | ||
{ | ||
return 'baz'; | ||
} | ||
else | ||
{ | ||
return str + 'bar'; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
// require all test files | ||
const testsContext = require.context('./', true, /Spec\.ts$/); | ||
const testsContext = require.context( | ||
'./', | ||
true, | ||
/Spec\.ts/ | ||
); | ||
|
||
testsContext.keys().forEach(testsContext); | ||
|
||
// require all source files | ||
const sourcesContext = require.context('../src/', true, /\.ts$/); | ||
const sourcesContext = require.context( | ||
'../src/', | ||
true, | ||
/\.ts$/ | ||
); | ||
|
||
sourcesContext.keys().forEach(sourcesContext); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters