kopia lustrzana https://github.com/c9/core
fix config test
rodzic
6b16562f97
commit
b6fe30715a
|
@ -6,13 +6,14 @@
|
|||
|
||||
|
||||
require("amd-loader");
|
||||
require("c9/setup_paths")
|
||||
require("c9/setup_paths");
|
||||
require("c9/inline-mocha")(module);
|
||||
|
||||
var assert = require("assert");
|
||||
var fs = require("fs");
|
||||
var Module = require("module");
|
||||
|
||||
describe("client config consistency", function(){
|
||||
describe("client config consistency", function() {
|
||||
// this.timeout(60000);
|
||||
|
||||
var fileCache = Object.create(null);
|
||||
|
@ -50,6 +51,15 @@ describe("client config consistency", function(){
|
|||
fetchClientOptions(callback);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function resolveModulePath(base, packagePath) {
|
||||
return Module._resolveFilename(packagePath, {
|
||||
paths: Module._nodeModulePaths(base),
|
||||
filename: base,
|
||||
id: base,
|
||||
});
|
||||
}
|
||||
|
||||
function checkConfig(name, clientOptions, next) {
|
||||
var hasError = false;
|
||||
|
@ -75,8 +85,7 @@ describe("client config consistency", function(){
|
|||
filePath = require.resolve(p.packagePath.replace(/^plugins\//, ""));
|
||||
} catch (e) {
|
||||
// TODO instead of quessing we need a simple way of getting pathmap
|
||||
if (configPath != configPathReal)
|
||||
filePath = require.resolve(configPathReal + "/../../node_modules/" + p.packagePath.replace(/^plugins\//, ""));
|
||||
filePath = resolveModulePath(configPathReal, p.packagePath.replace(/^plugins\//, ""));
|
||||
}
|
||||
}
|
||||
if (!filePath.match(/\.js$/))
|
||||
|
|
|
@ -88,9 +88,9 @@ if (typeof module === "object") (function () {
|
|||
// This throws, make sure to wrap in try..catch
|
||||
function resolvePackageSync(base, packagePath) {
|
||||
return Module._resolveFilename(packagePath, {
|
||||
paths: Module._nodeModulePaths(base),
|
||||
filename: base + "/package.json",
|
||||
id: base + "/package.json",
|
||||
paths: Module._nodeModulePaths(base),
|
||||
filename: base + "/package.json",
|
||||
id: base + "/package.json",
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue