mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-26 02:23:43 +03:00
Fix coverage
This commit is contained in:
parent
99cf070520
commit
76f06b1992
|
@ -14,6 +14,7 @@ var rename = require('gulp-rename');
|
|||
var argv = require('yargs').argv;
|
||||
var gulpIf = require('gulp-if');
|
||||
var sassCopm = require('node-sass');
|
||||
var ts = require('typescript');
|
||||
|
||||
gulp.task('build', function (callback) {
|
||||
if (argv.skipRebuild) {
|
||||
|
@ -52,6 +53,34 @@ gulp.task('tsc', function() {
|
|||
exec('tsc -p ./tsconfig.json');
|
||||
});
|
||||
|
||||
|
||||
// function compileTs(files, es5) {
|
||||
// var tsProject = ts.createProject('tsconfig.json');
|
||||
// var allFiles = [].concat(files, ['typings/**/*.d.ts']);
|
||||
// var res = gulp.src(allFiles, {
|
||||
// base: config.src,
|
||||
// outDir: config.tmp
|
||||
// })
|
||||
// .pipe(tslint())
|
||||
// .pipe(tslint.report('prose', {
|
||||
// summarizeFailureOutput: true,
|
||||
// emitError: !watchMode
|
||||
// }))
|
||||
// .pipe(sourcemaps.init())
|
||||
// .pipe(ts(tsProject))
|
||||
// .on('error', function () {
|
||||
// if (watchMode) {
|
||||
// return;
|
||||
// }
|
||||
// process.exit(1);
|
||||
// });
|
||||
// return res.js
|
||||
// .pipe(sourcemaps.write('.', {
|
||||
// includeContent: inline
|
||||
// }))
|
||||
// .pipe(gulp.dest(config.tmp));
|
||||
// }
|
||||
|
||||
gulp.task('inlineTemplates', ['tsc', 'sass'], function() {
|
||||
return gulp.src('.tmp/**/*.js', { base: './tmp' })
|
||||
.pipe(replace(/'(.*?)\.css'/g, '\'$1.scss\''))
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
var gulp = require('gulp');
|
||||
|
||||
var Server = require('karma').Server;
|
||||
var remapIstanbul = require('remap-istanbul/lib/gulpRemapIstanbul');
|
||||
|
||||
/**
|
||||
* Run test once and exit
|
||||
|
@ -9,5 +10,27 @@ gulp.task('test', ['concatPrism', 'inlineTemplates', 'injectVersionFile'], funct
|
|||
new Server({
|
||||
configFile: __dirname + '/../../karma.conf.js',
|
||||
singleRun: true
|
||||
}, done).start();
|
||||
}, karmaDone).start();
|
||||
|
||||
function karmaDone (exitCode) {
|
||||
remapCoverage(done, exitCode);
|
||||
}
|
||||
});
|
||||
|
||||
function remapCoverage(done, statusCode) {
|
||||
console.log('Remapping coverage to TypeScript format...');
|
||||
gulp.src('coverage/**/coverage-final.json')
|
||||
.pipe(remapIstanbul({
|
||||
reports: {
|
||||
'lcovonly': 'coverage/remap/lcov.info',
|
||||
'text-summary': 'coverage/remap/text-summary.txt',
|
||||
'html': 'coverage/remap'
|
||||
}
|
||||
}))
|
||||
.on('finish', function () {
|
||||
console.log('Remapping done!');
|
||||
console.log(cat('coverage/remap/text-summary.txt').stdout);
|
||||
console.log('Test Done with exit code: ' + statusCode);
|
||||
done(statusCode);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -3,13 +3,7 @@ module.exports = function (config) {
|
|||
config.set({
|
||||
frameworks: ['phantomjs-shim', 'jspm', 'jasmine', 'sinon', 'should'],
|
||||
preprocessors: {
|
||||
'lib/**/!(*spec).js': ['babel', 'regex', 'coverage']
|
||||
},
|
||||
|
||||
regexPreprocessor: {
|
||||
rules: [
|
||||
[ /'\.(.*?)\.scss'/g, '\'.tmp$1.css\'']
|
||||
]
|
||||
'.tmp/lib/**/!(*spec).js': ['babel', 'coverage']
|
||||
},
|
||||
babelPreprocessor: {
|
||||
options: {
|
||||
|
@ -29,13 +23,13 @@ module.exports = function (config) {
|
|||
coverageReporter: {
|
||||
instrumenters: { isparta : require('isparta') },
|
||||
instrumenter: {
|
||||
'lib/**/!(*spec).js': 'isparta'
|
||||
'.tmp/lib/**/!(*spec).js': 'isparta'
|
||||
},
|
||||
dir: 'coverage/',
|
||||
reporters: [
|
||||
{type: 'html'},
|
||||
{type: 'text-summary'},
|
||||
{type: 'lcov'}
|
||||
{type: 'lcov'},
|
||||
{type: 'json'}
|
||||
]
|
||||
},
|
||||
client: {
|
||||
|
@ -60,8 +54,7 @@ module.exports = function (config) {
|
|||
loadFiles: ['.tmp/tests/setup.js', '.tmp/tests/helpers.js', '.tmp/lib/**/*.js',
|
||||
'.tmp/tests/unit/*.js'],
|
||||
serveFiles: ['tests/schemas/**/*.json','tests/schemas/**/*.yml', 'lib/**/*.html',
|
||||
'.tmp/lib/**/*.json', '.tmp/*js', '.tmp/lib/**/*.css'],
|
||||
nocache: true
|
||||
'.tmp/lib/**/*.json', '.tmp/*js', '.tmp/lib/**/*.css']
|
||||
},
|
||||
|
||||
proxies: {
|
||||
|
|
|
@ -123,6 +123,7 @@
|
|||
"phantomjs-prebuilt": "^2.1.7",
|
||||
"protractor": "^3.0.0",
|
||||
"reflect-metadata": "^0.1.2",
|
||||
"remap-istanbul": "^0.6.4",
|
||||
"require-dir": "^0.3.0",
|
||||
"rollup-plugin-commonjs": "^2.2.1",
|
||||
"run-sequence": "^1.1.5",
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"module": "es6",
|
||||
"target": "es6",
|
||||
"noImplicitAny": false,
|
||||
"sourceMap": false,
|
||||
"sourceMap": true,
|
||||
"outDir": ".tmp/",
|
||||
"moduleResolution": "node"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user