mirror of
				https://github.com/Redocly/redoc.git
				synced 2025-10-30 23:37:28 +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 argv = require('yargs').argv; | ||||||
| var gulpIf = require('gulp-if'); | var gulpIf = require('gulp-if'); | ||||||
| var sassCopm = require('node-sass'); | var sassCopm = require('node-sass'); | ||||||
|  | var ts = require('typescript'); | ||||||
| 
 | 
 | ||||||
| gulp.task('build', function (callback) { | gulp.task('build', function (callback) { | ||||||
|   if (argv.skipRebuild) { |   if (argv.skipRebuild) { | ||||||
|  | @ -52,6 +53,34 @@ gulp.task('tsc', function() { | ||||||
|   exec('tsc -p ./tsconfig.json'); |   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() { | gulp.task('inlineTemplates', ['tsc', 'sass'], function() { | ||||||
|   return gulp.src('.tmp/**/*.js', { base: './tmp' }) |   return gulp.src('.tmp/**/*.js', { base: './tmp' }) | ||||||
|     .pipe(replace(/'(.*?)\.css'/g, '\'$1.scss\'')) |     .pipe(replace(/'(.*?)\.css'/g, '\'$1.scss\'')) | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| var gulp = require('gulp'); | var gulp = require('gulp'); | ||||||
| 
 | 
 | ||||||
| var Server = require('karma').Server; | var Server = require('karma').Server; | ||||||
|  | var remapIstanbul = require('remap-istanbul/lib/gulpRemapIstanbul'); | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Run test once and exit |  * Run test once and exit | ||||||
|  | @ -9,5 +10,27 @@ gulp.task('test', ['concatPrism', 'inlineTemplates', 'injectVersionFile'], funct | ||||||
|   new Server({ |   new Server({ | ||||||
|     configFile: __dirname + '/../../karma.conf.js', |     configFile: __dirname + '/../../karma.conf.js', | ||||||
|     singleRun: true |     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({ |     config.set({ | ||||||
|         frameworks: ['phantomjs-shim', 'jspm', 'jasmine', 'sinon', 'should'], |         frameworks: ['phantomjs-shim', 'jspm', 'jasmine', 'sinon', 'should'], | ||||||
|         preprocessors: { |         preprocessors: { | ||||||
|           'lib/**/!(*spec).js': ['babel', 'regex', 'coverage'] |           '.tmp/lib/**/!(*spec).js': ['babel', 'coverage'] | ||||||
|         }, |  | ||||||
| 
 |  | ||||||
|         regexPreprocessor: { |  | ||||||
|           rules: [ |  | ||||||
|             [ /'\.(.*?)\.scss'/g, '\'.tmp$1.css\''] |  | ||||||
|           ] |  | ||||||
|         }, |         }, | ||||||
|         babelPreprocessor: { |         babelPreprocessor: { | ||||||
|             options: { |             options: { | ||||||
|  | @ -29,13 +23,13 @@ module.exports = function (config) { | ||||||
|         coverageReporter: { |         coverageReporter: { | ||||||
|             instrumenters: { isparta : require('isparta') }, |             instrumenters: { isparta : require('isparta') }, | ||||||
|             instrumenter: { |             instrumenter: { | ||||||
|                 'lib/**/!(*spec).js': 'isparta' |                 '.tmp/lib/**/!(*spec).js': 'isparta' | ||||||
|             }, |             }, | ||||||
|             dir: 'coverage/', |             dir: 'coverage/', | ||||||
|             reporters: [ |             reporters: [ | ||||||
|                 {type: 'html'}, |                 {type: 'html'}, | ||||||
|                 {type: 'text-summary'}, |                 {type: 'lcov'}, | ||||||
|                 {type: 'lcov'} |                 {type: 'json'} | ||||||
|             ] |             ] | ||||||
|         }, |         }, | ||||||
|         client: { |         client: { | ||||||
|  | @ -60,8 +54,7 @@ module.exports = function (config) { | ||||||
|             loadFiles: ['.tmp/tests/setup.js', '.tmp/tests/helpers.js', '.tmp/lib/**/*.js', |             loadFiles: ['.tmp/tests/setup.js', '.tmp/tests/helpers.js', '.tmp/lib/**/*.js', | ||||||
|             '.tmp/tests/unit/*.js'], |             '.tmp/tests/unit/*.js'], | ||||||
|             serveFiles: ['tests/schemas/**/*.json','tests/schemas/**/*.yml', 'lib/**/*.html', |             serveFiles: ['tests/schemas/**/*.json','tests/schemas/**/*.yml', 'lib/**/*.html', | ||||||
|             '.tmp/lib/**/*.json', '.tmp/*js', '.tmp/lib/**/*.css'], |             '.tmp/lib/**/*.json', '.tmp/*js', '.tmp/lib/**/*.css'] | ||||||
|             nocache: true |  | ||||||
|         }, |         }, | ||||||
| 
 | 
 | ||||||
|         proxies: { |         proxies: { | ||||||
|  |  | ||||||
|  | @ -123,6 +123,7 @@ | ||||||
|     "phantomjs-prebuilt": "^2.1.7", |     "phantomjs-prebuilt": "^2.1.7", | ||||||
|     "protractor": "^3.0.0", |     "protractor": "^3.0.0", | ||||||
|     "reflect-metadata": "^0.1.2", |     "reflect-metadata": "^0.1.2", | ||||||
|  |     "remap-istanbul": "^0.6.4", | ||||||
|     "require-dir": "^0.3.0", |     "require-dir": "^0.3.0", | ||||||
|     "rollup-plugin-commonjs": "^2.2.1", |     "rollup-plugin-commonjs": "^2.2.1", | ||||||
|     "run-sequence": "^1.1.5", |     "run-sequence": "^1.1.5", | ||||||
|  |  | ||||||
|  | @ -5,7 +5,7 @@ | ||||||
| 		"module": "es6", | 		"module": "es6", | ||||||
| 		"target": "es6", | 		"target": "es6", | ||||||
| 		"noImplicitAny": false, | 		"noImplicitAny": false, | ||||||
| 		"sourceMap": false, | 		"sourceMap": true, | ||||||
| 		"outDir": ".tmp/", | 		"outDir": ".tmp/", | ||||||
| 		"moduleResolution": "node" | 		"moduleResolution": "node" | ||||||
| 	}, | 	}, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user