This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Add sourcemap support for coverage by using remap-istanbul #23
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind changing this to awesome-typescript-loader, but if we use a separate webpack config for test we could theoretically still use the 'default' ts-loader here. Maybe we should test the performance of the loaders when we have a bigger test project in skeleton. For now though, let's just use the same loader for both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the idea was to use the same loader for both tests and distribution builds, so we know that if the tests can correctly run the generated code, the distribution builds should be fine as well.
Still, we use the normal TypeScript compiler for npm builds, so that's a difference we cannot overcome. (The 'default
ts-loader
is still different than the standalonetsc
, so we will never get rid of that difference)