add smartstream

This commit is contained in:
2016-09-25 20:22:10 +02:00
parent 71588595e6
commit 7c960649bc
15 changed files with 163 additions and 46 deletions

View File

@ -23,6 +23,7 @@ export import smartcov = require('smartcov');
export import smartenv = require('smartenv');
export import smartfile = require('smartfile');
export import smartpath = require('smartpath');
export import smartstream = require('smartstream');
export import smartstring = require('smartstring');
export declare let sourceMapSupport: any;
export import tsn = require('tsn');

View File

@ -24,6 +24,7 @@ exports.smartcov = require("smartcov");
exports.smartenv = require("smartenv");
exports.smartfile = require("smartfile");
exports.smartpath = require("smartpath");
exports.smartstream = require("smartstream");
exports.smartstring = require("smartstring");
exports.sourceMapSupport = require('source-map-support').install(); // display errors correctly during testing
exports.tsn = require("tsn");

View File

@ -1,4 +1,5 @@
/// <reference types="q" />
import 'typings-global';
import plugins = require('./npmts.plugins');
export declare let run: (configArg: any) => plugins.q.Promise<{}>;
import { INpmtsConfig } from './npmts.options';
export declare let run: (configArg: INpmtsConfig) => plugins.q.Promise<{}>;

49
dist/npmts.tests.js vendored
View File

@ -4,8 +4,8 @@ const plugins = require("./npmts.plugins");
const paths = require("./npmts.paths");
const npmts_promisechain_1 = require("./npmts.promisechain");
/**
*
* @returns {*}
* runs mocha
* @returns INpmtsConfig
*/
let mocha = function (configArg) {
npmts_promisechain_1.npmtsOra.text('Instrumentalizing and testing transpiled JS');
@ -22,22 +22,31 @@ let mocha = function (configArg) {
.pipe(plugins.g.sourcemaps.write())
.pipe(plugins.g.injectModules())
.on('finish', function () {
plugins.gulp.src([plugins.path.join(paths.cwd, 'test/test.js')])
.pipe(plugins.g.babel({
presets: [
require.resolve('babel-preset-es2015')
]
}))
.pipe(plugins.g.injectModules())
.pipe(plugins.g.mocha())
.pipe(plugins.g.istanbul.writeReports({
dir: plugins.path.join(paths.cwd, './coverage'),
reporters: ['lcovonly', 'json', 'text', 'text-summary']
}))
.pipe(plugins.g.gFunction(function () {
plugins.beautylog.ok('Tested!');
done.resolve(configArg);
}, 'atEnd'));
let localSmartstream = new plugins.smartstream.Smartstream([
plugins.gulp.src([plugins.path.join(paths.cwd, 'test/test.js')]),
plugins.g.babel({
presets: [
require.resolve('babel-preset-es2015')
]
}),
plugins.g.injectModules(),
plugins.g.mocha(),
plugins.g.istanbul.writeReports({
dir: plugins.path.join(paths.cwd, './coverage'),
reporters: ['lcovonly', 'json', 'text', 'text-summary']
})
]);
localSmartstream.run()
.then(() => { done.resolve(configArg); }, (err) => {
plugins.beautylog.error('Tests failed!');
configArg.watch = true;
if (configArg.watch) {
done.resolve(configArg);
}
else {
process.exit(1);
}
});
});
return done.promise;
};
@ -55,7 +64,9 @@ let coverage = function (configArg) {
+ `coverage fails your treshold of `
+ `${configArg.coverageTreshold.toString()}%`);
plugins.beautylog.error('exiting due to coverage failure');
process.exit(1);
if (!configArg.watch) {
process.exit(1);
}
}
done.resolve(configArg);
});

View File

@ -1,3 +1,4 @@
/// <reference types="q" />
import * as plugins from './npmts.plugins';
export declare let run: (configArg: any) => plugins.q.Promise<{}>;
import { INpmtsConfig } from './npmts.options';
export declare let run: (configArg: INpmtsConfig) => plugins.q.Promise<{}>;

3
dist/npmts.watch.js vendored
View File

@ -9,6 +9,9 @@ exports.run = (configArg) => {
for (let key in configArg.ts) {
pathsToWatch.push(key);
}
for (let key in configArg.testTs) {
pathsToWatch.push(key);
}
npmtsSmartchok = new plugins.smartchok.Smartchok(pathsToWatch);
npmtsSmartchok.getObservableFor('change').then((changeObservableArg) => {
plugins.beautylog.info('now watching...');