diff options
Diffstat (limited to 'test/run_tests.js')
-rw-r--r-- | test/run_tests.js | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/test/run_tests.js b/test/run_tests.js index f62810f7e..88aded741 100644 --- a/test/run_tests.js +++ b/test/run_tests.js @@ -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); - -// We might need thins in the future ... -global.nodeRequire = function (modulePath) { - return require(modulePath); -}; - -global.require = global.nodeRequire; +let emsc = require("../lib/emscripten/libwrapper.js"); -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); }); - - |