mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Fix test runner
This commit is contained in:
parent
df5545ffd6
commit
3c4ec550c4
|
@ -22,19 +22,24 @@ window.addEventListener("message", event => {
|
||||||
launchTest(response => {
|
launchTest(response => {
|
||||||
event.source.postMessage(response, "*");
|
event.source.postMessage(response, "*");
|
||||||
});
|
});
|
||||||
|
}, error => {
|
||||||
|
event.source.postMessage({ status: "failed", errorMessage: error }, "*");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function appendFiles(files, index, callback) {
|
function appendFiles(files, index, callback, errorCallback) {
|
||||||
if (index === files.length) {
|
if (index === files.length) {
|
||||||
callback();
|
callback();
|
||||||
} else {
|
} else {
|
||||||
let fileName = "file://" + files[index];
|
let fileName = "file://" + files[index];
|
||||||
let script = document.createElement("script");
|
let script = document.createElement("script");
|
||||||
script.src = fileName;
|
|
||||||
script.onload = () => {
|
script.onload = () => {
|
||||||
appendFiles(files, index + 1, callback);
|
appendFiles(files, index + 1, callback, errorCallback);
|
||||||
};
|
};
|
||||||
|
script.onerror = () => {
|
||||||
|
errorCallback("failed to load script" + fileName);
|
||||||
|
};
|
||||||
|
script.src = fileName;
|
||||||
document.body.appendChild(script);
|
document.body.appendChild(script);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
import * as fs from "./promise-fs.js";
|
import * as fs from "./promise-fs.js";
|
||||||
|
import * as nodePath from "path";
|
||||||
import * as http from "http";
|
import * as http from "http";
|
||||||
import { server as WebSocketServer } from "websocket";
|
import { server as WebSocketServer } from "websocket";
|
||||||
|
|
||||||
|
@ -83,7 +84,7 @@ async function runAll() {
|
||||||
console.log();
|
console.log();
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("Tests run: " + runner.testRun + ", failed: " + runner.testsFailed.length
|
console.log("Tests run: " + runner.testsRun + ", failed: " + runner.testsFailed.length
|
||||||
+ ", elapsed " + ((endTime - startTime) / 1000) + " seconds");
|
+ ", elapsed " + ((endTime - startTime) / 1000) + " seconds");
|
||||||
|
|
||||||
if (runner.testsFailed.length > 0) {
|
if (runner.testsFailed.length > 0) {
|
||||||
|
@ -143,7 +144,7 @@ class TestRunner {
|
||||||
request.tests = suite.testCases.map(testCase => {
|
request.tests = suite.testCases.map(testCase => {
|
||||||
return {
|
return {
|
||||||
name: testCase.name,
|
name: testCase.name,
|
||||||
files: testCase.files.map(fileName => process.cwd() + "/" + fileName)
|
files: testCase.files.map(fileName => nodePath.resolve(process.cwd(), fileName))
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
this.testsRun += suite.testCases.length;
|
this.testsRun += suite.testCases.length;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user