Skip to content

Commit

Permalink
feat: unattended mode, descriptive skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
3cp committed Mar 3, 2019
1 parent 325dc84 commit 0123c58
Show file tree
Hide file tree
Showing 498 changed files with 7,789 additions and 10,191 deletions.
5 changes: 1 addition & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
}]
},
"parserOptions": {
"sourceType": "script",
"ecmaFeatures": {
"impliedStrict": false
}
"sourceType": "script"
},
"env": {
"node": true,
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ bower_components
.DS_STORE
*.swp
.blog
release-checks-results
/release-checks-results
/.nyc_output
/coverage
12 changes: 12 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"include": [
"lib/**/*.js"
],
"exclude": [
"lib/build/amodro-trace/lib/**/*.js"
],
"reporter": [
"lcov",
"text"
]
}
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ os:
- osx
language: node_js
node_js:
- "8.9"
- "8"
- "10"
10 changes: 5 additions & 5 deletions build/args.js
Original file line number Diff line number Diff line change
@@ -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 + '".');
}

Expand Down
19 changes: 0 additions & 19 deletions build/paths.js

This file was deleted.

7 changes: 3 additions & 4 deletions build/tasks/lint.js
Original file line number Diff line number Diff line change
@@ -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());
Expand Down
25 changes: 11 additions & 14 deletions build/tasks/prepare-release.js
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
94 changes: 45 additions & 49 deletions build/tasks/release-check.js
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
95 changes: 0 additions & 95 deletions build/tasks/release-checks/matching-test-suite-selector.js

This file was deleted.

1 change: 0 additions & 1 deletion build/tasks/release-checks/message-history-logger.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict';
const fs = require('../../../lib/file-system');

exports.MessageHistoryLogger = class {
Expand Down
7 changes: 2 additions & 5 deletions build/tasks/release-checks/reporter.js
Original file line number Diff line number Diff line change
@@ -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:');
Expand Down
Loading

0 comments on commit 0123c58

Please sign in to comment.