diff --git a/tests/src/test/js/frame.js b/tests/src/test/js/frame.js index e09a445ac..a5e20f032 100644 --- a/tests/src/test/js/frame.js +++ b/tests/src/test/js/frame.js @@ -22,19 +22,24 @@ window.addEventListener("message", event => { launchTest(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) { callback(); } else { let fileName = "file://" + files[index]; let script = document.createElement("script"); - script.src = fileName; 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); } } diff --git a/tests/src/test/js/src/run-tests.js b/tests/src/test/js/src/run-tests.js index 5f6cff1e5..c5aeda8c6 100644 --- a/tests/src/test/js/src/run-tests.js +++ b/tests/src/test/js/src/run-tests.js @@ -16,6 +16,7 @@ "use strict"; import * as fs from "./promise-fs.js"; +import * as nodePath from "path"; import * as http from "http"; import { server as WebSocketServer } from "websocket"; @@ -83,7 +84,7 @@ async function runAll() { 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"); if (runner.testsFailed.length > 0) { @@ -143,7 +144,7 @@ class TestRunner { request.tests = suite.testCases.map(testCase => { return { 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;