Skip to content

Commit c647723

Browse files
committed
fixed tests
1 parent e9cf798 commit c647723

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

lib/declarations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interface INpmInstallationManager {
1010
getLatestVersion(packageName: string): IFuture<string>;
1111
getNextVersion(packageName: string): IFuture<string>;
1212
getLatestCompatibleVersion(packageName: string): IFuture<string>;
13-
getInspectorFromCache(inspectorNpmPackageName: string): IFuture<string>;
13+
getInspectorFromCache(inspectorNpmPackageName: string, projectDir: string): IFuture<string>;
1414
}
1515

1616
interface INpmInstallOptions {

lib/npm-installation-manager.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export class NpmInstallationManager implements INpmInstallationManager {
66
private static NPM_LOAD_FAILED = "Failed to retrieve data from npm. Please try again a little bit later.";
77

88
constructor(private $npm: INodePackageManager,
9-
private $projectData: IProjectData,
109
private $childProcess: IChildProcess,
1110
private $logger: ILogger,
1211
private $errors: IErrors,
@@ -59,9 +58,9 @@ export class NpmInstallationManager implements INpmInstallationManager {
5958
}).future<string>()();
6059
}
6160

62-
public getInspectorFromCache(inspectorNpmPackageName: string) : IFuture<string> {
61+
public getInspectorFromCache(inspectorNpmPackageName: string, projectDir: string) : IFuture<string> {
6362
return (() => {
64-
let inspectorPath = path.join(this.$projectData.projectDir, "node_modules", inspectorNpmPackageName);
63+
let inspectorPath = path.join(projectDir, "node_modules", inspectorNpmPackageName);
6564

6665
// local installation takes precedence over cache
6766
if(!this.inspectorAlreadyInstalled(inspectorPath).wait()) {

lib/services/ios-debug-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class IOSDebugService implements IDebugService {
214214
private openAppInspector(fileDescriptor: string): IFuture<void> {
215215
if (this.$options.client) {
216216
return (() => {
217-
let inspectorPath = this.$npmInstallationManager.getInspectorFromCache(inspectorNpmPackageName).wait();
217+
let inspectorPath = this.$npmInstallationManager.getInspectorFromCache(inspectorNpmPackageName, this.$projectData.projectDir).wait();
218218

219219
let inspectorSourceLocation = path.join(inspectorPath, inspectorUiDir, "Main.html");
220220
let inspectorApplicationPath = path.join(inspectorPath, inspectorAppName);

test/npm-installation-manager.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import * as OptionsLib from "../lib/options";
99
import * as StaticConfigLib from "../lib/config";
1010
import Future = require("fibers/future");
1111
import * as yok from "../lib/common/yok";
12+
import ChildProcessLib = require("../lib/common/child-process");
1213

1314
function createTestInjector(): IInjector {
1415
let testInjector = new yok.Yok();
@@ -21,6 +22,7 @@ function createTestInjector(): IInjector {
2122
testInjector.register("fs", FsLib.FileSystem);
2223
testInjector.register("hostInfo", HostInfoLib.HostInfo);
2324
testInjector.register("staticConfig", StaticConfigLib.StaticConfig);
25+
testInjector.register("childProcess", ChildProcessLib.ChildProcess);
2426

2527
testInjector.register("npmInstallationManager", NpmInstallationManagerLib.NpmInstallationManager);
2628

test/stubs.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ export class NpmInstallationManagerStub implements INpmInstallationManager {
230230
getLatestCompatibleVersion(packageName: string): IFuture<string> {
231231
return Future.fromResult("");
232232
}
233+
234+
getInspectorFromCache(name: string, projectDir: string): IFuture<string> {
235+
return Future.fromResult("");
236+
}
233237
}
234238

235239
export class ProjectDataStub implements IProjectData {

0 commit comments

Comments
 (0)