Index: test_wrapper.js |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/test_wrapper.js |
@@ -0,0 +1,24 @@ |
+#!/usr/bin/env node --harmony |
Thomas Greiner
2016/02/17 15:32:50
Detail: Seems a bit redundant to specify it here a
Wladimir Palant
2016/02/17 15:53:01
Right, this file was originally run directly - it
|
+"use strict"; |
+ |
+require("node-babel")({ |
+ extensions: [".js"] |
+}); |
+ |
+// HACK: override Node's module resolution to match the way bootstrap.js |
+// resolves modules right now. |
Thomas Greiner
2016/02/17 15:32:50
You can simply set the "NODE_PATH" environment var
Wladimir Palant
2016/02/17 15:53:01
Nice catch, originally this wasn't possible as the
|
+let fs = require("fs"); |
+let knownModules = fs.readdirSync("lib").map(f => f.replace(/\.js$/, "")); |
+knownModules = new Set(knownModules); |
+ |
+let nodeModule = require("module"); |
+let origResolve = nodeModule._resolveFilename; |
+nodeModule._resolveFilename = function() |
+{ |
+ let params = Array.slice(arguments); |
+ if (knownModules.has(params[0])) |
+ params[0] = "./" + params[0]; |
+ return origResolve.apply(this, params); |
+}; |
+ |
+require("./node_modules/.bin/nodeunit"); |