Skip to content

Commit

Permalink
add runtime and skipped info
Browse files Browse the repository at this point in the history
  • Loading branch information
hkollmann committed Feb 15, 2021
1 parent 01f94c5 commit fc2f3ee
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
19 changes: 15 additions & 4 deletions compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ const writeFile = promisify(fs.writeFile);
const mkdir = promisify(fs.mkdir);
const path = require('path');
const { URL } = require("url");
const { performance } = require('perf_hooks');

qx.Class.define("qxl.testtapper.compile.LibraryApi", {
extend: qx.tool.cli.api.LibraryApi,

members: {

// @overridden
// @overridden
async initialize() {
let yargs = qx.tool.cli.commands.Test.getYargsCommand;
qx.tool.cli.commands.Test.getYargsCommand = () => {
Expand All @@ -33,7 +34,7 @@ qx.Class.define("qxl.testtapper.compile.LibraryApi", {
type: "boolean",
default: false
};
/*
/*
args.builder.coverage = {
describe: "writes coverage infos, only working for chromium yet",
type: "boolean",
Expand All @@ -53,7 +54,7 @@ qx.Class.define("qxl.testtapper.compile.LibraryApi", {
},

__enviroment: null,
// @overridden
// @overridden
load: async function () {
let command = this.getCompilerApi().getCommand();
if (command instanceof qx.tool.cli.commands.Test) {
Expand Down Expand Up @@ -101,11 +102,15 @@ qx.Class.define("qxl.testtapper.compile.LibraryApi", {
}
let Ok = 0;
let notOk = 0;
let skipped = 0;
let startTime;
page.on("console", async (msg) => {
let val = msg.text();
// value is serializable
if (val.match(/^\d+\.\.\d+$/)) {
qx.tool.compiler.Console.info(`DONE testing ${Ok} ok, ${notOk} not ok`);
let endTime = performance.now();
let timeDiff = endTime - startTime;
qx.tool.compiler.Console.info(`DONE testing ${Ok} ok, ${notOk} not ok, ${skipped} skipped - [${timeDiff.toFixed(0)} ms]`);
if (cov) {
qx.tool.compiler.Console.info("writing coverage information ...");
const coverage = await page.coverage.stopJSCoverage();
Expand Down Expand Up @@ -146,6 +151,11 @@ qx.Class.define("qxl.testtapper.compile.LibraryApi", {
} else if (val.match(/^not ok /)) {
notOk++;
qx.tool.compiler.Console.log(val);
} else if (val.includes("# SKIP")) {
skipped++;
if (!app.argv.terse) {
qx.tool.compiler.Console.log(val);
}
} else if (val.match(/^ok\s/)) {
Ok++;
if (!app.argv.terse) {
Expand All @@ -157,6 +167,7 @@ qx.Class.define("qxl.testtapper.compile.LibraryApi", {
qx.tool.compiler.Console.log(val);
}
});
startTime = performance.now();
page.goto(url.href);
} catch (e) {
reject(e);
Expand Down
7 changes: 3 additions & 4 deletions source/class/qxl/testtapper/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,14 @@ qx.Class.define("qxl.testtapper.Application", {
let test = item.test.getFullName();
that._failed[test] = true;
that._cnt++;
let message = String(item.exception);
if (item.exception) {
if (item.exception.message) {
message = item.exception.message;
let message = item.exception.message;
this.info(`not ok ${that._cnt} - ${test} - [${numberFormat.format(timeDiff)}] - ${message}`);
let [testClass, ...testName] = test.split(":");
this.addTreeItem("not ok", that._cnt, testClass, testName.join(""), message);
} else {
this.error("# " + item.exception);
this.error("# " + item.exception.toString());
}
}
} else {
Expand Down Expand Up @@ -246,7 +245,7 @@ qx.Class.define("qxl.testtapper.Application", {
that._cnt++;
let test = evt.getData()[0].test.getFullName();
that._failed[test] = true;
this.info(`ok ${that._cnt} - # SKIP ${test}`);
this.info(`ok ${that._cnt} - # SKIP ${test} - ${evt.getData()[0].exception.toString()}`);
});
next();
});
Expand Down

0 comments on commit fc2f3ee

Please sign in to comment.