Merge branch 'master' of ssh://taler.net/var/git/wallet-webex
This commit is contained in:
commit
eae096e609
@ -4,7 +4,8 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "wxwallet.js",
|
"main": "wxwallet.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "mocha --delay"
|
"test": "mocha --delay",
|
||||||
|
"test-cover": "istanbul cover -x libwrapper.js _mocha -- --delay"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -26,13 +27,15 @@
|
|||||||
"gulp-tar": "^1.8.0",
|
"gulp-tar": "^1.8.0",
|
||||||
"gulp-typescript": "^2.10.0",
|
"gulp-typescript": "^2.10.0",
|
||||||
"gulp-zip": "^3.1.0",
|
"gulp-zip": "^3.1.0",
|
||||||
|
"istanbul-lib-instrument": "^1.0.0-alpha.6",
|
||||||
"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",
|
||||||
"typescript": "^1.9.0-dev.20160225",
|
"typescript": "^1.9.0-dev.20160225",
|
||||||
|
"typhonjs-istanbul-instrument-jspm": "^0.1.0",
|
||||||
"vinyl": "^1.1.1"
|
"vinyl": "^1.1.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,44 +12,42 @@
|
|||||||
let assert = require("better-assert");
|
let assert = require("better-assert");
|
||||||
let vm = require("vm");
|
let vm = require("vm");
|
||||||
let fs = require("fs");
|
let fs = require("fs");
|
||||||
|
let instrument = require("typhonjs-istanbul-instrument-jspm").default;
|
||||||
|
|
||||||
if ("function" !== typeof run) {
|
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,
|
||||||
|
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");
|
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