Restore code coverage in Karma config
The transpiling step is done by babel instead of bublé now. Bublé caused the istanbul instrumenter step to crash because of an unexpected SourceMap object format.
This commit is contained in:
@@ -27,6 +27,10 @@ jobs:
|
|||||||
name: Run Tests
|
name: Run Tests
|
||||||
command: npm test
|
command: npm test
|
||||||
|
|
||||||
|
- store_artifacts:
|
||||||
|
path: coverage/
|
||||||
|
destination: coverage
|
||||||
|
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: rendering/cases/
|
path: rendering/cases/
|
||||||
destination: rendering
|
destination: rendering
|
||||||
|
|||||||
@@ -41,12 +41,15 @@
|
|||||||
"rbush": "2.0.2"
|
"rbush": "2.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.4.0",
|
||||||
|
"@babel/preset-env": "^7.4.2",
|
||||||
"@openlayers/eslint-plugin": "^4.0.0-beta.2",
|
"@openlayers/eslint-plugin": "^4.0.0-beta.2",
|
||||||
"@types/arcgis-rest-api": "^10.4.4",
|
"@types/arcgis-rest-api": "^10.4.4",
|
||||||
"@types/geojson": "^7946.0.7",
|
"@types/geojson": "^7946.0.7",
|
||||||
"@types/pbf": "^3.0.1",
|
"@types/pbf": "^3.0.1",
|
||||||
"@types/rbush": "^2.0.2",
|
"@types/rbush": "^2.0.2",
|
||||||
"@types/topojson-specification": "^1.0.1",
|
"@types/topojson-specification": "^1.0.1",
|
||||||
|
"babel-loader": "^8.0.5",
|
||||||
"buble": "^0.19.7",
|
"buble": "^0.19.7",
|
||||||
"buble-loader": "^0.5.1",
|
"buble-loader": "^0.5.1",
|
||||||
"chaikin-smooth": "^1.0.4",
|
"chaikin-smooth": "^1.0.4",
|
||||||
@@ -63,12 +66,14 @@
|
|||||||
"handlebars": "4.1.2",
|
"handlebars": "4.1.2",
|
||||||
"html-to-image": "^0.1.0",
|
"html-to-image": "^0.1.0",
|
||||||
"istanbul": "0.4.5",
|
"istanbul": "0.4.5",
|
||||||
|
"istanbul-instrumenter-loader": "^3.0.1",
|
||||||
"jquery": "3.4.1",
|
"jquery": "3.4.1",
|
||||||
"jsdoc": "3.5.5",
|
"jsdoc": "3.5.5",
|
||||||
"jsdoc-plugin-typescript": "^1.0.8",
|
"jsdoc-plugin-typescript": "^1.0.8",
|
||||||
"karma": "^4.0.1",
|
"karma": "^4.0.1",
|
||||||
"karma-chrome-launcher": "2.2.0",
|
"karma-chrome-launcher": "2.2.0",
|
||||||
"karma-coverage": "^1.1.2",
|
"karma-coverage": "^1.1.2",
|
||||||
|
"karma-coverage-istanbul-reporter": "^2.0.5",
|
||||||
"karma-firefox-launcher": "^1.1.0",
|
"karma-firefox-launcher": "^1.1.0",
|
||||||
"karma-mocha": "1.3.0",
|
"karma-mocha": "1.3.0",
|
||||||
"karma-sourcemap-loader": "^0.3.7",
|
"karma-sourcemap-loader": "^0.3.7",
|
||||||
|
|||||||
+24
-27
@@ -2,6 +2,7 @@ const path = require('path');
|
|||||||
|
|
||||||
module.exports = function(karma) {
|
module.exports = function(karma) {
|
||||||
karma.set({
|
karma.set({
|
||||||
|
browsers: ['Chrome'],
|
||||||
browserDisconnectTolerance: 2,
|
browserDisconnectTolerance: 2,
|
||||||
frameworks: ['mocha'],
|
frameworks: ['mocha'],
|
||||||
client: {
|
client: {
|
||||||
@@ -54,7 +55,12 @@ module.exports = function(karma) {
|
|||||||
preprocessors: {
|
preprocessors: {
|
||||||
'**/*.js': ['webpack', 'sourcemap']
|
'**/*.js': ['webpack', 'sourcemap']
|
||||||
},
|
},
|
||||||
reporters: ['dots'],
|
reporters: ['dots', 'coverage-istanbul'],
|
||||||
|
coverageIstanbulReporter: {
|
||||||
|
reports: ['text-summary', 'html'],
|
||||||
|
dir: path.resolve(__dirname, '../coverage/'),
|
||||||
|
fixWebpackSourcePaths: true
|
||||||
|
},
|
||||||
webpack: {
|
webpack: {
|
||||||
devtool: 'inline-source-map',
|
devtool: 'inline-source-map',
|
||||||
mode: 'development',
|
mode: 'development',
|
||||||
@@ -63,8 +69,23 @@ module.exports = function(karma) {
|
|||||||
{
|
{
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
use: {
|
use: {
|
||||||
loader: 'buble-loader'
|
loader: 'babel-loader',
|
||||||
}
|
options: {
|
||||||
|
presets: ['@babel/preset-env']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
include: path.resolve('src/ol/'),
|
||||||
|
exclude: path.resolve('node_modules/')
|
||||||
|
}, {
|
||||||
|
test: /\.js$/,
|
||||||
|
use: {
|
||||||
|
loader: 'istanbul-instrumenter-loader',
|
||||||
|
options: {
|
||||||
|
esModules: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
include: path.resolve('src/ol/'),
|
||||||
|
exclude: path.resolve('node_modules/')
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -75,28 +96,4 @@ module.exports = function(karma) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
process.env.CHROME_BIN = require('puppeteer').executablePath();
|
process.env.CHROME_BIN = require('puppeteer').executablePath();
|
||||||
if (process.env.CIRCLECI) {
|
|
||||||
karma.set({
|
|
||||||
browsers: ['Chrome'],
|
|
||||||
preprocessors: {
|
|
||||||
'../src/**/*.js': ['coverage']
|
|
||||||
},
|
|
||||||
coverageReporter: {
|
|
||||||
reporters: [
|
|
||||||
{
|
|
||||||
type: 'lcovonly', // that's enough for coveralls, no HTML
|
|
||||||
dir: '../coverage/',
|
|
||||||
subdir: '.'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'text-summary' // prints the textual summary to the terminal
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
karma.set({
|
|
||||||
browsers: ['Chrome']
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user