2016-01-10 20:07:42 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Bridge between the mocha test runner / nodejs
|
|
|
|
* and the typescript / the wallet's module system.
|
|
|
|
*
|
|
|
|
* The test cases use better-assert as assert library
|
|
|
|
* with mocha's bdd UI.
|
|
|
|
*/
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
let assert = require("better-assert");
|
|
|
|
let vm = require("vm");
|
|
|
|
let fs = require("fs");
|
|
|
|
|
|
|
|
|
|
|
|
if ("function" !== typeof run) {
|
|
|
|
throw Error("test must be run with 'mocha --delay ...'");
|
|
|
|
}
|
|
|
|
|
2016-04-27 15:06:56 +02:00
|
|
|
let emsc = require("../lib/emscripten/libwrapper.js");
|
2016-01-10 20:07:42 +01:00
|
|
|
|
2016-04-27 15:06:56 +02:00
|
|
|
// Do it here, since it breaks 'require'' for libwrapper
|
2016-01-10 20:07:42 +01:00
|
|
|
let System = require("systemjs");
|
|
|
|
|
|
|
|
System.config({
|
|
|
|
defaultJSExtensions: true
|
|
|
|
});
|
|
|
|
|
2016-04-27 15:06:56 +02:00
|
|
|
let mod = System.newModule({Module: emsc});
|
2016-01-10 20:07:42 +01:00
|
|
|
let modName = System.normalizeSync(__dirname + "/../lib/emscripten/emsc");
|
|
|
|
console.log("registering", modName);
|
|
|
|
System.set(modName, mod);
|
|
|
|
|
|
|
|
System.import("./test/tests/taler.js")
|
|
|
|
.then((t) => {
|
|
|
|
t.declareTests(assert, context, it);
|
2016-04-27 15:06:56 +02:00
|
|
|
setTimeout(run, 1);
|
2016-01-10 20:07:42 +01:00
|
|
|
})
|
|
|
|
.catch((e) => {
|
|
|
|
console.error("failed to load module", e.stack);
|
|
|
|
});
|