Skip to content
Permalink
Browse files

feat: unattended mode, descriptive skeleton

  • Loading branch information...
huochunpeng committed Feb 12, 2019
1 parent 325dc84 commit 0123c58394d238c224e5e2ddfc5dad6d13a93b26
Showing 498 changed files with 7,789 additions and 10,191 deletions.
@@ -15,10 +15,7 @@
}]
},
"parserOptions": {
"sourceType": "script",
"ecmaFeatures": {
"impliedStrict": false
}
"sourceType": "script"
},
"env": {
"node": true,
@@ -5,4 +5,6 @@ bower_components
.DS_STORE
*.swp
.blog
release-checks-results
/release-checks-results
/.nyc_output
/coverage
12 .nycrc
@@ -0,0 +1,12 @@
{
"include": [
"lib/**/*.js"
],
"exclude": [
"lib/build/amodro-trace/lib/**/*.js"
],
"reporter": [
"lcov",
"text"
]
}
@@ -4,5 +4,6 @@ os:
- osx
language: node_js
node_js:
- "8.9"
- "8"
- "10"
@@ -1,10 +1,10 @@
var yargs = require('yargs');
const yargs = require('yargs');

var argv = yargs.argv,
validBumpTypes = "major|minor|patch|prerelease".split("|"),
bump = (argv.bump || 'patch').toLowerCase();
const argv = yargs.argv;
const validBumpTypes = ['major', 'minor', 'patch', 'prerelease'];
const bump = (argv.bump || 'patch').toLowerCase();

if(validBumpTypes.indexOf(bump) === -1) {
if (validBumpTypes.indexOf(bump) === -1) {
throw new Error('Unrecognized bump "' + bump + '".');
}

This file was deleted.

Oops, something went wrong.
@@ -1,9 +1,8 @@
var gulp = require('gulp');
var paths = require('../paths');
var eslint = require('gulp-eslint');
const gulp = require('gulp');
const eslint = require('gulp-eslint');

gulp.task('lint', function() {
return gulp.src([paths.source, paths.specs])
return gulp.src(['lib/**/*.js', 'spec/**/*.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failOnError());
@@ -1,21 +1,18 @@
var gulp = require('gulp');
var paths = require('../paths');
var conventionalChangelog = require('gulp-conventional-changelog');
var fs = require('fs');
var bump = require('gulp-bump');
var args = require('../args');
const gulp = require('gulp');
const conventionalChangelog = require('gulp-conventional-changelog');
const bump = require('gulp-bump');
const args = require('../args');

gulp.task('bump-version', function(){
return gulp.src(['./package.json'])
.pipe(bump({type:args.bump })) //major|minor|patch|prerelease
gulp.task('bump-version', function() {
return gulp.src('package.json')
.pipe(bump({type: args.bump })) //major|minor|patch|prerelease
.pipe(gulp.dest('./'));
});

gulp.task('changelog', function () {
return gulp.src(paths.doc + '/CHANGELOG.md').pipe(conventionalChangelog({
preset: 'angular'
}))
.pipe(gulp.dest(paths.doc));
gulp.task('changelog', function() {
return gulp.src('doc/CHANGELOG.md')
.pipe(conventionalChangelog({preset: 'angular'}))
.pipe(gulp.dest('doc'));
});

gulp.task('prepare-release', gulp.series(
@@ -1,83 +1,79 @@
'use strict';
const gulp = require('gulp');
const path = require('path');
const SuiteRunner = require('./release-checks/suite-runner');
const LogManager = require('aurelia-logging');
const Utils = require('../../lib/build/utils');
const ConsoleUI = require('../../lib/ui').ConsoleUI;
const MessageHistoryLogger = require('./release-checks/message-history-logger').MessageHistoryLogger;
const MatchingTestSuiteSelector = require('./release-checks/matching-test-suite-selector');
const {MessageHistoryLogger} = require('./release-checks/message-history-logger');
const TestProjectsSelector = require('./release-checks/test-projects-selector');
const Reporter = require('./release-checks/reporter');
const del = require('del');
const ConsoleUI = require('../../lib/ui').ConsoleUI;
const ui = new ConsoleUI();
const c = require('ansi-colors');

let ui = new ConsoleUI();
let logger;
let msgHistoryLogger;
let originalDir = process.cwd();
let resultOutputFolder = path.join(originalDir, 'release-checks-results');

gulp.task('empty-release-checks-results-folder', (done) => {
gulp.task('empty-release-checks-results-folder', () => {
return del([
resultOutputFolder + '/**/*'
]);
});

gulp.task('release-check', gulp.series(
'empty-release-checks-results-folder',
function(done) {
async function() {
configureLogging();

const reporter = new Reporter();
const selector = new MatchingTestSuiteSelector();
const selector = new TestProjectsSelector();

return selector.execute()
.then(suites => {
return Utils.runSequentially(
suites,
suite => {
logger.info(`Executing ${suite.title}`);
const {testDir, dirs} = await selector.execute();
const testSuitesResults = await Utils.runSequentially(
dirs,
async(dir, i) => {
logger.info(c.inverse(`Executing ${i + 1}/${dirs.length} ${dir}`));

const context = {
suite: suite,
resultOutputFolder: path.join(resultOutputFolder, suite.title),
workingDirectory: suite.dir
};
const suiteRunner = new SuiteRunner(context, reporter);
const context = {
suite: dir,
resultOutputFolder: path.join(resultOutputFolder, dir),
workingDirectory: path.join(testDir, dir)
};
const suiteRunner = new SuiteRunner(context, reporter);

return suiteRunner.run()
.then(steps => {
return writeLog(context.resultOutputFolder, 'log-full.txt')
.then(() => steps);
})
.catch(e => {
logger.error(e);
throw e;
});
try {
const result = await suiteRunner.run();
await writeLog(context.resultOutputFolder, 'log-full.txt');
return result;
} catch (e) {
logger.error(e);
throw e;
}
)
.then(testSuitesResults => {
if (testSuitesResults.length > 1) {
console.log('---------------------------');
console.log('---------------------------');
console.log('--------SUMMARY-----------');
console.log('---------------------------');
console.log('---------------------------');
}
);

for (const result of testSuitesResults) {
reporter.logSummary(result.suite, result.steps);
}
}
if (testSuitesResults.length > 1) {
console.log('---------------------------');
console.log('---------------------------');
console.log('--------SUMMARY-----------');
console.log('---------------------------');
console.log('---------------------------');

for (const result of testSuitesResults) {
reporter.logSummary(result.suite, result.steps);
}
}

return writeLog(resultOutputFolder, 'summary.txt');
});
});
})
);
await writeLog(resultOutputFolder, 'summary.txt');
}
));

function writeLog(dir, name) {
async function writeLog(dir, name) {
const filePath = path.join(dir, name);
return msgHistoryLogger.writeToDisk(filePath)
.then(() => msgHistoryLogger.clearHistory());
await msgHistoryLogger.writeToDisk(filePath);
await msgHistoryLogger.clearHistory();
}

function configureLogging() {

This file was deleted.

Oops, something went wrong.
@@ -1,4 +1,3 @@
'use strict';
const fs = require('../../../lib/file-system');

exports.MessageHistoryLogger = class {
@@ -1,26 +1,23 @@
'use strict';

const LogManager = require('aurelia-logging');
const logger = LogManager.getLogger('Runner');

module.exports = class Reporter {
starting(context) {
const suite = context.suite;
logger.info('***********RUNNING SUITE************');
logger.info(`*** Suite: ${suite.title}`);
logger.info(`*** Suite: ${suite}`);
logger.info(`*** Project: ${context.workingDirectory}`);
logger.info('************************************');
}

finished(steps, context) {
const suite = context.suite;

this.logSummary(suite, steps);
}

logSummary(suite, steps) {
logger.info('************* RESULT ***************');
logger.info(`*** Suite: ${suite.title}`);
logger.info(`*** Suite: ${suite}`);
logger.info('************************************');

logger.info('Executed tasks:');
Oops, something went wrong.

0 comments on commit 0123c58

Please sign in to comment.
You can’t perform that action at this time.