mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 03:26:01 +00:00
Support a "--noserver" command line option in tests:
* Run npm/integration tests without launching rippled, using a running instance of rippled (possibly in a debugger) instead. * Works for "npm test" and "mocha"
This commit is contained in:
committed by
Nik Bougalis
parent
5d6ea3d75f
commit
a691632995
@@ -5,6 +5,7 @@ var Amount = require('ripple-lib').Amount;
|
||||
var Remote = require('ripple-lib').Remote;
|
||||
var Transaction = require('ripple-lib').Transaction;
|
||||
var Server = require('./server').Server;
|
||||
var path = require("path");
|
||||
var server = { };
|
||||
|
||||
function get_config() {
|
||||
@@ -28,7 +29,35 @@ get_server_config =
|
||||
function(config, host) {
|
||||
config = config || init_config();
|
||||
host = host || config.server_default;
|
||||
return extend({}, config.default_server_config, config.servers[host]);
|
||||
// Override the config with the command line if provided.
|
||||
var override = {};
|
||||
// --noserver -> no_server
|
||||
if (process.env["npm_config_noserver"]) {
|
||||
override["no_server"] = true;
|
||||
} else {
|
||||
override["no_server"] = process.argv.indexOf("--noserver") > -1;
|
||||
}
|
||||
// --rippled -> rippled_path
|
||||
var index = -1;
|
||||
if (process.env["npm_config_rippled"]) {
|
||||
override["rippled_path"] = path.resolve(process.cwd(),
|
||||
process.env["npm_config_rippled"]);
|
||||
} else if ((index = process.argv.indexOf("--rippled")) > -1) {
|
||||
if (index < process.argv.length) {
|
||||
override["rippled_path"] = path.resolve(process.cwd(),
|
||||
process.argv[index + 1]);
|
||||
}
|
||||
} else {
|
||||
for (var i = process.argv.length-1; i >= 0; --i) {
|
||||
var arg = process.argv[i].split("=", 2);
|
||||
if (arg.length === 2 && arg[0] === "--rippled") {
|
||||
override["rippled_path"] = path.resolve(process.cwd(), arg[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return extend({}, config.default_server_config, config.servers[host],
|
||||
override);
|
||||
}
|
||||
|
||||
function prepare_tests(tests, fn) {
|
||||
|
||||
Reference in New Issue
Block a user