blob: 88aded741b565c617ca7d5cd6e6b68eb4b6fb5e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/**
* 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");
let instrument = require("typhonjs-istanbul-instrument-jspm").default;
if ("function" !== typeof run) {
throw Error("test must be run with 'mocha --delay ...'");
}
let emsc = require("../lib/emscripten/libwrapper.js");
// Do it here, since it breaks 'require'' for libwrapper
let System = require("systemjs");
System.config({
defaultJSExtensions: true,
meta: {
'./test/tests/taler.js': {
format: 'register'
},
'./lib/wallet/*': {
format: 'register'
}
}
});
instrument(System);
let mod = System.newModule({Module: emsc});
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);
setTimeout(run, 1);
})
.catch((e) => {
console.error("failed to load module", e.stack);
});
|