From b6fe30715a2bbe65b591e4173e24acbfd8cbc75d Mon Sep 17 00:00:00 2001 From: nightwing Date: Mon, 13 Feb 2017 10:43:55 +0000 Subject: [PATCH] fix config test --- configs/client-config_test.js | 17 +++++++++++++---- node_modules/architect/architect.js | 6 +++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/configs/client-config_test.js b/configs/client-config_test.js index 6b21bc06..c26942dd 100755 --- a/configs/client-config_test.js +++ b/configs/client-config_test.js @@ -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$/)) diff --git a/node_modules/architect/architect.js b/node_modules/architect/architect.js index 6f5f315c..37981a36 100644 --- a/node_modules/architect/architect.js +++ b/node_modules/architect/architect.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", }); }