Merge branch 'master' of ssh://taler.net/var/git/wallet-webex

This commit is contained in:
Marcello Stanisci 2016-04-27 16:58:17 +02:00
commit eae096e609
3 changed files with 24 additions and 34 deletions

View File

@ -4,7 +4,8 @@
"description": "",
"main": "wxwallet.js",
"scripts": {
"test": "mocha --delay"
"test": "mocha --delay",
"test-cover": "istanbul cover -x libwrapper.js _mocha -- --delay"
},
"repository": {
"type": "git",
@ -26,13 +27,15 @@
"gulp-tar": "^1.8.0",
"gulp-typescript": "^2.10.0",
"gulp-zip": "^3.1.0",
"istanbul-lib-instrument": "^1.0.0-alpha.6",
"jed": "^1.1.0",
"map-stream": "0.0.6",
"mocha": "^2.3.4",
"mocha": "^2.4.5",
"po2json": "git+https://github.com/mikeedwards/po2json",
"systemjs": "^0.19.14",
"through2": "^2.0.1",
"typescript": "^1.9.0-dev.20160225",
"typhonjs-istanbul-instrument-jspm": "^0.1.0",
"vinyl": "^1.1.1"
}
}

View File

@ -12,44 +12,42 @@
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 ...'");
}
console.log("typeof require (here)", typeof require);
let emsc = require("../lib/emscripten/libwrapper.js");
// We might need thins in the future ...
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''
// Do it here, since it breaks 'require'' for libwrapper
let System = require("systemjs");
System.config({
defaultJSExtensions: true
defaultJSExtensions: true,
meta: {
'./test/tests/taler.js': {
format: 'register'
},
'./lib/wallet/*': {
format: 'register'
}
}
});
let mod = System.newModule({Module: Module});
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);
run();
setTimeout(run, 1);
})
.catch((e) => {
console.error("failed to load module", e.stack);
});

View File

@ -5,20 +5,9 @@ declare var HttpMockLib;
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 j = x.toJson();
assert("value" in j);
});
it("retries", function() {
let m = new HttpMockLib();
/*m.intercept()
.matchUrlContains()
.counterEquals(0)
.count()
.sen*/
})
}
}