now catching babel errors

This commit is contained in:
Philipp Kunz 2016-11-25 00:36:44 +01:00
parent 00983205ce
commit 3fd755691d
2 changed files with 65 additions and 52 deletions

25
dist/mod02/index.js vendored
View File

@ -14,17 +14,18 @@ let mocha = function (configArg) {
npmts_log_1.npmtsOra.text('Instrumentalizing and testing transpiled JS'); npmts_log_1.npmtsOra.text('Instrumentalizing and testing transpiled JS');
npmts_log_1.npmtsOra.end(); // end npmtsOra for tests. npmts_log_1.npmtsOra.end(); // end npmtsOra for tests.
let done = q.defer(); let done = q.defer();
plugins.gulp.src([plugins.path.join(paths.cwd, 'dist/*.js')]) let babelCoverageSmartstream = new plugins.smartstream.Smartstream([
.pipe(plugins.gulpSourcemaps.init()) plugins.gulp.src([plugins.path.join(paths.cwd, 'dist/*.js')]),
.pipe(plugins.gulpBabel({ plugins.gulpSourcemaps.init(),
plugins.gulpBabel({
presets: [ presets: [
require.resolve('babel-preset-es2015') require.resolve('babel-preset-es2015')
] ]
})) }),
.pipe(plugins.gulpIstanbul({})) plugins.gulpIstanbul({}),
.pipe(plugins.gulpSourcemaps.write()) plugins.gulpSourcemaps.write(),
.pipe(plugins.gulpInjectModules()) plugins.gulpInjectModules()
.on('finish', function () { ]);
let localSmartstream = new plugins.smartstream.Smartstream([ let localSmartstream = new plugins.smartstream.Smartstream([
plugins.gulp.src([plugins.path.join(paths.cwd, 'test/test.js')]), plugins.gulp.src([plugins.path.join(paths.cwd, 'test/test.js')]),
plugins.gulpBabel({ plugins.gulpBabel({
@ -39,7 +40,9 @@ let mocha = function (configArg) {
reporters: ['lcovonly', 'json', 'text', 'text-summary'] reporters: ['lcovonly', 'json', 'text', 'text-summary']
}) })
]); ]);
localSmartstream.run() babelCoverageSmartstream.run()
.then(() => {
return localSmartstream.run()
.then(() => { done.resolve(configArg); }, (err) => { .then(() => { done.resolve(configArg); }, (err) => {
plugins.beautylog.error('Tests failed!'); plugins.beautylog.error('Tests failed!');
console.log(err); console.log(err);
@ -50,6 +53,8 @@ let mocha = function (configArg) {
process.exit(1); process.exit(1);
} }
}); });
}, (err) => {
console.log(err);
}); });
return done.promise; return done.promise;
}; };
@ -80,7 +85,7 @@ exports.run = function (configArg) {
let config = configArg; let config = configArg;
if (config.test === true) { if (config.test === true) {
npmts_log_1.npmtsOra.text('now starting tests'); npmts_log_1.npmtsOra.text('now starting tests');
plugins.beautylog.log('-------------------------------------------------------\n' + plugins.beautylog.log('------------------------------------------------------\n' +
'*************************** TESTS: ***************************\n' + '*************************** TESTS: ***************************\n' +
'--------------------------------------------------------------'); '--------------------------------------------------------------');
mocha(config) mocha(config)

View File

@ -17,18 +17,19 @@ let mocha = function (configArg: INpmtsConfig) {
npmtsOra.text('Instrumentalizing and testing transpiled JS') npmtsOra.text('Instrumentalizing and testing transpiled JS')
npmtsOra.end() // end npmtsOra for tests. npmtsOra.end() // end npmtsOra for tests.
let done = q.defer() let done = q.defer()
plugins.gulp.src([plugins.path.join(paths.cwd, 'dist/*.js')]) let babelCoverageSmartstream = new plugins.smartstream.Smartstream([
.pipe(plugins.gulpSourcemaps.init()) plugins.gulp.src([plugins.path.join(paths.cwd, 'dist/*.js')]),
.pipe(plugins.gulpBabel({ plugins.gulpSourcemaps.init(),
plugins.gulpBabel({
presets: [ presets: [
require.resolve('babel-preset-es2015') require.resolve('babel-preset-es2015')
] ]
})) }),
.pipe(plugins.gulpIstanbul({ plugins.gulpIstanbul({
})) }),
.pipe(plugins.gulpSourcemaps.write()) plugins.gulpSourcemaps.write(),
.pipe(plugins.gulpInjectModules()) plugins.gulpInjectModules()
.on('finish', function () { ])
let localSmartstream = new plugins.smartstream.Smartstream([ let localSmartstream = new plugins.smartstream.Smartstream([
plugins.gulp.src([plugins.path.join(paths.cwd, 'test/test.js')]), plugins.gulp.src([plugins.path.join(paths.cwd, 'test/test.js')]),
plugins.gulpBabel({ plugins.gulpBabel({
@ -43,7 +44,11 @@ let mocha = function (configArg: INpmtsConfig) {
reporters: ['lcovonly', 'json', 'text', 'text-summary'] reporters: ['lcovonly', 'json', 'text', 'text-summary']
}) })
]) ])
localSmartstream.run()
babelCoverageSmartstream.run()
.then(
() => {
return localSmartstream.run()
.then(() => { done.resolve(configArg) }, (err) => { .then(() => { done.resolve(configArg) }, (err) => {
plugins.beautylog.error('Tests failed!') plugins.beautylog.error('Tests failed!')
console.log(err) console.log(err)
@ -53,6 +58,9 @@ let mocha = function (configArg: INpmtsConfig) {
process.exit(1) process.exit(1)
} }
}) })
},
(err) => {
console.log(err)
}) })
return done.promise return done.promise
} }
@ -87,7 +95,7 @@ export let run = function (configArg: INpmtsConfig) {
if (config.test === true) { if (config.test === true) {
npmtsOra.text('now starting tests') npmtsOra.text('now starting tests')
plugins.beautylog.log( plugins.beautylog.log(
'-------------------------------------------------------\n' + '------------------------------------------------------\n' +
'*************************** TESTS: ***************************\n' + '*************************** TESTS: ***************************\n' +
'--------------------------------------------------------------' '--------------------------------------------------------------'
) )