diff --git a/build/tasks/build.js b/build/tasks/build.js index 6f8e285c..b51a3e35 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -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\'')) diff --git a/build/tasks/test.js b/build/tasks/test.js index 444b2307..bbc250d8 100644 --- a/build/tasks/test.js +++ b/build/tasks/test.js @@ -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); + }); +}; diff --git a/karma.conf.js b/karma.conf.js index a3a61e34..d62dc1cb 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -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: { diff --git a/lib/shared/components/DropDown/drop-down.css.shim.ts b/lib/shared/components/DropDown/drop-down.css.shim.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/package.json b/package.json index dea001a5..e5b6a8aa 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/tsconfig.json b/tsconfig.json index 004efca4..3ffbe052 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,7 @@ "module": "es6", "target": "es6", "noImplicitAny": false, - "sourceMap": false, + "sourceMap": true, "outDir": ".tmp/", "moduleResolution": "node" },