Fixing long-output-delay issue on Travis CI.
This commit is contained in:
parent
3198bc27fd
commit
30a84d8577
22
gulpfile.js
22
gulpfile.js
@ -15,7 +15,9 @@ var sourcemaps = require('gulp-sourcemaps');
|
||||
var uglify = require('gulp-uglify');
|
||||
var buffer = require('vinyl-buffer');
|
||||
|
||||
function createTransform(transforms) {
|
||||
function createTransform(transforms, show) {
|
||||
if (!show) { show = { }; }
|
||||
|
||||
function padding(length) {
|
||||
let pad = '';
|
||||
while (pad.length < length) { pad += ' '; }
|
||||
@ -44,12 +46,19 @@ function createTransform(transforms) {
|
||||
}
|
||||
var size = fs.readFileSync(path).length;
|
||||
if (transformed != null) {
|
||||
console.log('Transformed:', shortPath, padding(70 - shortPath.length), size, padding(6 - String(size).length), '=>', transformed.length);
|
||||
if (show.transformed) {
|
||||
console.log('Transformed:', shortPath, padding(70 - shortPath.length), size, padding(6 - String(size).length), '=>', transformed.length);
|
||||
}
|
||||
data = transformed;
|
||||
} else if (shortPath === '/src.ts/wordlists/wordlist.ts') {
|
||||
data += '\n\nexportWordlist = true;'
|
||||
if (show.transformed) {
|
||||
console.log('Transformed:', shortPath, padding(70 - shortPath.length), size, padding(6 - String(size).length), '=>', data.length);
|
||||
}
|
||||
} else {
|
||||
console.log('Preserved: ', shortPath, padding(70 - shortPath.length), size);
|
||||
if (show.preserved) {
|
||||
console.log('Preserved: ', shortPath, padding(70 - shortPath.length), size);
|
||||
}
|
||||
}
|
||||
this.queue(data);
|
||||
this.queue(null);
|
||||
@ -64,6 +73,7 @@ function createTransform(transforms) {
|
||||
* Target: dist/ethers{.min,}.js
|
||||
*/
|
||||
function taskBundle(name, options) {
|
||||
var show = options.show || { };
|
||||
|
||||
// The elliptic package.json is only used for its version
|
||||
var ellipticPackage = require('elliptic/package.json');
|
||||
@ -134,7 +144,7 @@ function taskBundle(name, options) {
|
||||
cache: { },
|
||||
packageCache: {},
|
||||
standalone: "ethers",
|
||||
transform: [ [ createTransform(transforms), { global: true } ] ],
|
||||
transform: [ [ createTransform(transforms, show), { global: true } ] ],
|
||||
})
|
||||
.bundle()
|
||||
.pipe(source(options.filename))
|
||||
@ -153,10 +163,10 @@ function taskBundle(name, options) {
|
||||
}
|
||||
|
||||
// Creates dist/ethers.js
|
||||
taskBundle("default", { filename: "ethers.js", dest: 'dist', minify: false });
|
||||
taskBundle("default", { filename: "ethers.js", dest: 'dist', show: { transformed: true, preserved: true }, minify: false });
|
||||
|
||||
// Creates dist/ethers.js
|
||||
taskBundle("default-test", { filename: "ethers.js", dest: 'tests/dist', minify: false });
|
||||
taskBundle("default-test", { filename: "ethers.js", dest: 'tests/dist', show: { transformed: true }, minify: false });
|
||||
|
||||
// Creates dist/ethers.min.js
|
||||
taskBundle("minified", { filename: "ethers.min.js", dest: 'dist', minify: true });
|
||||
|
@ -15,19 +15,28 @@ function Reporter(runner) {
|
||||
var self = this;
|
||||
var suites = [];
|
||||
|
||||
var lastOutput = getTime();
|
||||
|
||||
function getIndent() {
|
||||
var result = '';
|
||||
for (var i = 0; i < suites.length; i++) { result += ' '; }
|
||||
return result;
|
||||
}
|
||||
|
||||
function log(message) {
|
||||
if (!message) { message = ''; }
|
||||
var indent = getIndent();
|
||||
console.log(indent + message);
|
||||
lastOutput = getTime();
|
||||
}
|
||||
|
||||
runner.on('suite', function(suite) {
|
||||
if (!suite.title) {
|
||||
console.log(getIndent() + 'Testing: Found ' + suite.suites.length + ' test suites');
|
||||
log('Testing: Found ' + suite.suites.length + ' test suites');
|
||||
} else {
|
||||
var filename = (suite.file || '').split('/').pop();
|
||||
if (filename) { filename = ' (' + filename + ')'; }
|
||||
console.log(getIndent() + 'Test Suite: ' + suite.title + filename);
|
||||
log('Test Suite: ' + suite.title + filename);
|
||||
}
|
||||
suites.push(suite);
|
||||
suite._t0 = getTime();
|
||||
@ -38,8 +47,8 @@ function Reporter(runner) {
|
||||
|
||||
runner.on('suite end', function() {
|
||||
var suite = suites.pop();
|
||||
console.log(getIndent() + ' Total Tests: ' + suite._countPass + '/' + suite._countTotal + ' passed ' + getDelta(suite._t0));
|
||||
console.log('');
|
||||
log(' Total Tests: ' + suite._countPass + '/' + suite._countTotal + ' passed ' + getDelta(suite._t0));
|
||||
log();
|
||||
if (suites.length > 0) {
|
||||
var currentSuite = suites[suites.length - 1];
|
||||
currentSuite._countFail += suite._countFail;
|
||||
@ -50,6 +59,10 @@ function Reporter(runner) {
|
||||
|
||||
runner.on('test', function(test) {
|
||||
var currentSuite = suites[suites.length - 1];
|
||||
if (((getTime() - lastOutput) / 1000) > 60) {
|
||||
log('[ Still running suite - test #' + currentSuite._countTotal + ' ]');
|
||||
lastOutput = getTime();
|
||||
}
|
||||
currentSuite._countTotal++;
|
||||
});
|
||||
|
||||
@ -62,42 +75,35 @@ function Reporter(runner) {
|
||||
|
||||
if (countFail > 100) {
|
||||
if (countFail === 101) {
|
||||
console.log(indent + '[ Over 100 errors; skipping remaining suite output ]');
|
||||
log('[ Over 100 errors; skipping remaining suite output ]');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (countFail > 25) {
|
||||
console.log(indent + 'Failure: ' + test.title + ' (too many errors; skipping dump)');
|
||||
log('Failure: ' + test.title + ' (too many errors; skipping dump)');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(indent + 'Failure: ' + test.title);
|
||||
log('Failure: ' + test.title);
|
||||
error.toString().split('\n').forEach(function(line) {
|
||||
console.log(indent + ' ' + line);
|
||||
log(' ' + line);
|
||||
});
|
||||
Object.keys(error).forEach(function(key) {
|
||||
console.log(indent + ' ' + key + ': ' + error[key]);
|
||||
});
|
||||
error.stack.split('\n').forEach(function(line) {
|
||||
console.log(indent + ' ' + line);
|
||||
log(' ' + key + ': ' + error[key]);
|
||||
});
|
||||
if (error.stack) {
|
||||
log("Stack Trace:");
|
||||
error.stack.split('\n').forEach(function(line) {
|
||||
log(' ' + line);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
runner.on('pass', function(test) {
|
||||
var currentSuite = suites[suites.length - 1];
|
||||
currentSuite._countPass++;
|
||||
});
|
||||
|
||||
/*
|
||||
runner.once('end', function() {
|
||||
var ds = ((new Date()).getTime() - t0) / 1000;
|
||||
var minutes = ds / 60;
|
||||
var seconds = String(ds % 60);
|
||||
while (seconds.length < 2) { seconds = '0' + seconds; }
|
||||
console.log('Completed in ' + minutes + ':' + seconds);
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
module.exports = Reporter;
|
||||
|
Loading…
Reference in New Issue
Block a user