get test skeleton working again
This commit is contained in:
parent
07715206e5
commit
004a0372ab
@ -28,7 +28,7 @@
|
|||||||
"gulp-zip": "^3.1.0",
|
"gulp-zip": "^3.1.0",
|
||||||
"jed": "^1.1.0",
|
"jed": "^1.1.0",
|
||||||
"map-stream": "0.0.6",
|
"map-stream": "0.0.6",
|
||||||
"mocha": "^2.3.4",
|
"mocha": "^2.4.5",
|
||||||
"po2json": "git+https://github.com/mikeedwards/po2json",
|
"po2json": "git+https://github.com/mikeedwards/po2json",
|
||||||
"systemjs": "^0.19.14",
|
"systemjs": "^0.19.14",
|
||||||
"through2": "^2.0.1",
|
"through2": "^2.0.1",
|
||||||
|
@ -18,38 +18,25 @@ if ("function" !== typeof run) {
|
|||||||
throw Error("test must be run with 'mocha --delay ...'");
|
throw Error("test must be run with 'mocha --delay ...'");
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("typeof require (here)", typeof require);
|
let emsc = require("../lib/emscripten/libwrapper.js");
|
||||||
|
|
||||||
// We might need thins in the future ...
|
// Do it here, since it breaks 'require'' for libwrapper
|
||||||
global.nodeRequire = function (modulePath) {
|
|
||||||
return require(modulePath);
|
|
||||||
};
|
|
||||||
|
|
||||||
global.require = global.nodeRequire;
|
|
||||||
|
|
||||||
let data = fs.readFileSync("lib/emscripten/libwrapper.js");
|
|
||||||
vm.runInThisContext(data);
|
|
||||||
|
|
||||||
// Do it here, since it breaks 'require''
|
|
||||||
let System = require("systemjs");
|
let System = require("systemjs");
|
||||||
|
|
||||||
System.config({
|
System.config({
|
||||||
defaultJSExtensions: true
|
defaultJSExtensions: true
|
||||||
});
|
});
|
||||||
|
|
||||||
let mod = System.newModule({Module: Module});
|
let mod = System.newModule({Module: emsc});
|
||||||
let modName = System.normalizeSync(__dirname + "/../lib/emscripten/emsc");
|
let modName = System.normalizeSync(__dirname + "/../lib/emscripten/emsc");
|
||||||
console.log("registering", modName);
|
console.log("registering", modName);
|
||||||
System.set(modName, mod);
|
System.set(modName, mod);
|
||||||
|
|
||||||
|
|
||||||
System.import("./test/tests/taler.js")
|
System.import("./test/tests/taler.js")
|
||||||
.then((t) => {
|
.then((t) => {
|
||||||
t.declareTests(assert, context, it);
|
t.declareTests(assert, context, it);
|
||||||
run();
|
setTimeout(run, 1);
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.error("failed to load module", e.stack);
|
console.error("failed to load module", e.stack);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,20 +5,9 @@ declare var HttpMockLib;
|
|||||||
|
|
||||||
export function declareTests(assert, context, it) {
|
export function declareTests(assert, context, it) {
|
||||||
|
|
||||||
it("works!", function() {
|
it("calls native emscripten code", function() {
|
||||||
let x = new Emsc.Amount({value: 42, fraction: 42, currency: "EUR"});
|
let x = new Emsc.Amount({value: 42, fraction: 42, currency: "EUR"});
|
||||||
let j = x.toJson();
|
let j = x.toJson();
|
||||||
assert("value" in j);
|
assert("value" in j);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it("retries", function() {
|
|
||||||
let m = new HttpMockLib();
|
|
||||||
/*m.intercept()
|
|
||||||
.matchUrlContains()
|
|
||||||
.counterEquals(0)
|
|
||||||
.count()
|
|
||||||
.sen*/
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user