CI: added coverage artifacts.
This commit is contained in:
parent
bb8e77dc70
commit
28dbcfc38c
21
.github/workflows/nodejs.yml
vendored
21
.github/workflows/nodejs.yml
vendored
@ -21,7 +21,9 @@ jobs:
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- run: npm ci
|
||||
- run: npm run build-all
|
||||
- run: npm run test-node
|
||||
@ -40,7 +42,9 @@ jobs:
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12.x
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- run: npm ci
|
||||
- run: npm run build-all
|
||||
- run: npm run test-browser-${{ matrix.module }}
|
||||
@ -58,7 +62,24 @@ jobs:
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12.x
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- run: npm ci
|
||||
- run: npm run build-all
|
||||
- run: npm run test-coverage
|
||||
|
||||
- name: Upload Coverage Summary
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: coverage-summary
|
||||
path: ./output/summary.txt
|
||||
|
||||
- name: Tar files
|
||||
run: tar -cvf ./output/coverage.tar ./output/lcov-report/
|
||||
|
||||
- name: Upload Coverage
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: coverage-complete
|
||||
path: ./output/coverage.tar
|
||||
|
@ -2,35 +2,63 @@
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// Maximum time in seconds to suppress output
|
||||
var MAX_DELAY = 30;
|
||||
var MAX_DELAY = 60;
|
||||
function getTime() {
|
||||
return (new Date()).getTime();
|
||||
}
|
||||
function ReporterKeepAlive(runner) {
|
||||
var suites = 0;
|
||||
var fails = 0;
|
||||
var errors = [];
|
||||
var stdoutWrite = process.stdout.write.bind(process.stdout);
|
||||
//process.stdout.write = function(buffer: string | Uint8Array, cb?: (err?: Error) => void): boolean {
|
||||
var stdoutWrite = process.stdout.write.bind(process.stdout);
|
||||
var logOut = "";
|
||||
var capturing = false;
|
||||
function log(message) {
|
||||
if (message == null) {
|
||||
message = "";
|
||||
}
|
||||
if (capturing) {
|
||||
logOut += message;
|
||||
}
|
||||
else {
|
||||
console.log(message);
|
||||
}
|
||||
}
|
||||
function captureLog(initialLog) {
|
||||
capturing = true;
|
||||
if (initialLog == null) {
|
||||
initialLog = "";
|
||||
}
|
||||
logOut = initialLog;
|
||||
process.stdout.write = function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
return stdoutWrite("*");
|
||||
logOut += "*";
|
||||
return true;
|
||||
};
|
||||
}
|
||||
function releaseLog() {
|
||||
capturing = false;
|
||||
var result = logOut;
|
||||
process.stdout.write = stdoutWrite;
|
||||
logOut = "";
|
||||
return result;
|
||||
}
|
||||
function ReporterKeepAlive(runner) {
|
||||
var suites = 0;
|
||||
var fails = 0;
|
||||
var errors = [];
|
||||
// Catch anything attempting to write to the consolea
|
||||
captureLog();
|
||||
// Force Output; Keeps the console output alive with periodic updates
|
||||
var lastOutput = getTime();
|
||||
function forceOutput() {
|
||||
if (((getTime() - lastOutput) / 1000) > MAX_DELAY) {
|
||||
log(".");
|
||||
var currentLog = releaseLog();
|
||||
console.log("# Keep Alive: " + currentLog);
|
||||
captureLog();
|
||||
lastOutput = getTime();
|
||||
}
|
||||
}
|
||||
var timer = setInterval(forceOutput, 1000);
|
||||
function log(message) {
|
||||
stdoutWrite(message);
|
||||
lastOutput = getTime();
|
||||
}
|
||||
runner.on('suite', function (suite) {
|
||||
suites++;
|
||||
fails = 0;
|
||||
@ -40,23 +68,30 @@ function ReporterKeepAlive(runner) {
|
||||
suites--;
|
||||
log("]");
|
||||
if (suites === 0) {
|
||||
process.stdout.write = stdoutWrite;
|
||||
// Reset standard output
|
||||
var currentLog = releaseLog();
|
||||
if (logOut.length) {
|
||||
console.log("# Keep Alive: " + currentLog);
|
||||
}
|
||||
// Stop the keep-alive poller
|
||||
clearTimeout(timer);
|
||||
console.log("");
|
||||
// Dump out any errors encountered
|
||||
console.log("#");
|
||||
if (errors.length) {
|
||||
console.log("---------------");
|
||||
console.log("# ---------------");
|
||||
errors.forEach(function (error, index) {
|
||||
if (index > 0) {
|
||||
console.log("");
|
||||
console.log("#");
|
||||
}
|
||||
console.log(error);
|
||||
error.toString().split("\n").forEach(function (line) {
|
||||
console.log("# " + line);
|
||||
});
|
||||
});
|
||||
}
|
||||
console.log("---------------");
|
||||
console.log("# ---------------");
|
||||
}
|
||||
});
|
||||
runner.on('test', function (test) {
|
||||
forceOutput();
|
||||
});
|
||||
runner.on('fail', function (test, error) {
|
||||
fails++;
|
||||
@ -66,7 +101,6 @@ function ReporterKeepAlive(runner) {
|
||||
}
|
||||
});
|
||||
runner.on('pass', function (test) {
|
||||
forceOutput();
|
||||
});
|
||||
runner.on('pending', function (test) {
|
||||
log("?");
|
||||
|
@ -3,7 +3,7 @@
|
||||
'use strict';
|
||||
|
||||
// Maximum time in seconds to suppress output
|
||||
const MAX_DELAY = 30;
|
||||
const MAX_DELAY = 60;
|
||||
|
||||
function getTime(): number {
|
||||
return (new Date()).getTime();
|
||||
@ -19,31 +19,61 @@ interface Runner {
|
||||
on(event: string, callback: (...args: Array<any>) => void): Runner;
|
||||
}
|
||||
|
||||
const stdoutWrite = process.stdout.write.bind(process.stdout);
|
||||
let logOut = "";
|
||||
let capturing = false;
|
||||
|
||||
function log(message?: string): void {
|
||||
if (message == null) { message = ""; }
|
||||
if (capturing) {
|
||||
logOut += message;
|
||||
} else {
|
||||
console.log(message);
|
||||
}
|
||||
}
|
||||
|
||||
function captureLog(initialLog?: string): void {
|
||||
capturing = true;
|
||||
|
||||
if (initialLog == null) { initialLog = ""; }
|
||||
logOut = initialLog
|
||||
|
||||
process.stdout.write = function(...args: Array<any>): boolean {
|
||||
logOut += "*";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function releaseLog(): string {
|
||||
capturing = false;
|
||||
|
||||
const result = logOut;
|
||||
process.stdout.write = stdoutWrite;
|
||||
logOut = "";
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
export function ReporterKeepAlive(runner: Runner) {
|
||||
let suites = 0;
|
||||
let fails = 0;
|
||||
const errors: Array<string> = [ ];
|
||||
|
||||
const stdoutWrite = process.stdout.write.bind(process.stdout);
|
||||
//process.stdout.write = function(buffer: string | Uint8Array, cb?: (err?: Error) => void): boolean {
|
||||
process.stdout.write = function(...args: Array<any>): boolean {
|
||||
return stdoutWrite("*");
|
||||
}
|
||||
// Catch anything attempting to write to the consolea
|
||||
captureLog();
|
||||
|
||||
// Force Output; Keeps the console output alive with periodic updates
|
||||
let lastOutput = getTime();
|
||||
function forceOutput() {
|
||||
if (((getTime() - lastOutput) / 1000) > MAX_DELAY) {
|
||||
log(".");
|
||||
let currentLog = releaseLog();
|
||||
console.log(`# Keep Alive: ${ currentLog }`);
|
||||
captureLog();
|
||||
lastOutput = getTime();
|
||||
}
|
||||
}
|
||||
const timer = setInterval(forceOutput, 1000);
|
||||
|
||||
function log(message: string): void {
|
||||
stdoutWrite(message);
|
||||
lastOutput = getTime();
|
||||
}
|
||||
|
||||
runner.on('suite', function(suite: Suite) {
|
||||
suites++;
|
||||
fails = 0;
|
||||
@ -55,22 +85,32 @@ export function ReporterKeepAlive(runner: Runner) {
|
||||
log("]");
|
||||
|
||||
if (suites === 0) {
|
||||
process.stdout.write = stdoutWrite;
|
||||
// Reset standard output
|
||||
const currentLog = releaseLog();
|
||||
|
||||
if (logOut.length) {
|
||||
console.log(`# Keep Alive: ${ currentLog }`);
|
||||
}
|
||||
|
||||
// Stop the keep-alive poller
|
||||
clearTimeout(timer);
|
||||
console.log("")
|
||||
|
||||
// Dump out any errors encountered
|
||||
console.log("#")
|
||||
if (errors.length) {
|
||||
console.log("---------------")
|
||||
console.log("# ---------------")
|
||||
errors.forEach((error, index) => {
|
||||
if (index > 0) { console.log(""); }
|
||||
console.log(error);
|
||||
if (index > 0) { console.log("#"); }
|
||||
error.toString().split("\n").forEach((line) => {
|
||||
console.log(`# ${ line }`);
|
||||
});
|
||||
});
|
||||
}
|
||||
console.log("---------------")
|
||||
console.log("# ---------------")
|
||||
}
|
||||
});
|
||||
|
||||
runner.on('test', function(test) {
|
||||
forceOutput();
|
||||
});
|
||||
|
||||
runner.on('fail', function(test, error) {
|
||||
@ -82,8 +122,6 @@ export function ReporterKeepAlive(runner: Runner) {
|
||||
});
|
||||
|
||||
runner.on('pass', function(test) {
|
||||
forceOutput();
|
||||
|
||||
});
|
||||
|
||||
runner.on('pending', function(test) {
|
||||
|
Loading…
Reference in New Issue
Block a user