Skip to content

Commit a9b14a3

Browse files
Dimitar KerezovMitko-Kerezov
Dimitar Kerezov
authored andcommitted
Rebase
1 parent 9c41267 commit a9b14a3

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

lib/commands/test-init.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ class TestInitCommand implements ICommand {
5454
// e.g karma is installed; karma-jasmine depends on karma and will try to install it again
5555
try {
5656
await this.$npm.install(`${peerDependency}@${dependencyVersion}`, projectDir, {
57-
'save-dev': true
57+
'save-dev': true,
58+
disableNpmInstall: false,
59+
frameworkPath: this.$options.frameworkPath,
60+
ignoreScripts: this.$options.ignoreScripts,
61+
path: this.$options.path
5862
});
5963
} catch (e) {
6064
this.$logger.error(e.message);

lib/services/extensibility-service.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,10 @@ export class ExtensibilityService implements IExtensibilityService {
3232
const localPath = path.resolve(extensionName);
3333
const packageName = this.$fs.exists(localPath) ? localPath : extensionName;
3434

35-
const realName = (await this.$npm.install(packageName, this.pathToExtensions, npmOpts))[0];
35+
const installResultInfo = await this.$npm.install(packageName, this.pathToExtensions, npmOpts);
3636
this.$logger.trace(`Finished installation of extension '${extensionName}'. Trying to load it now.`);
3737

38-
// In case the extension is already installed, the $npm.install method will not return the name of the package.
39-
// Fallback to the original value.
40-
// NOTE: This will not be required once $npm.install starts working correctly.
41-
return await this.loadExtension(realName || extensionName);
38+
return await this.loadExtension(installResultInfo.name);
4239
}
4340

4441
@exported("extensibilityService")

test/services/extensibility-service.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ describe("extensibilityService", () => {
7777
argsPassedToNpmInstall.packageName = packageName;
7878
argsPassedToNpmInstall.pathToSave = pathToSave;
7979
argsPassedToNpmInstall.config = config;
80-
return [userSpecifiedValue];
80+
return { name: userSpecifiedValue };
8181
};
8282

8383
const extensibilityService: IExtensibilityService = testInjector.resolve(ExtensibilityService);
@@ -130,7 +130,7 @@ describe("extensibilityService", () => {
130130
fs.readDirectory = (dir: string): string[] => [extensionName];
131131

132132
const npm: INodePackageManager = testInjector.resolve("npm");
133-
npm.install = async (packageName: string, pathToSave: string, config?: any): Promise<any> => [extensionName];
133+
npm.install = async (packageName: string, pathToSave: string, config?: any): Promise<any> => ({ name: extensionName });
134134

135135
const extensibilityService: IExtensibilityService = testInjector.resolve(ExtensibilityService);
136136
const actualResult = await extensibilityService.installExtension(extensionName);
@@ -148,7 +148,7 @@ describe("extensibilityService", () => {
148148
fs.readDirectory = (dir: string): string[] => [extensionName];
149149

150150
const npm: INodePackageManager = testInjector.resolve("npm");
151-
npm.install = async (packageName: string, pathToSave: string, config?: any): Promise<any> => [extensionName];
151+
npm.install = async (packageName: string, pathToSave: string, config?: any): Promise<any> => ({ name: extensionName });
152152

153153
const requireService: IRequireService = testInjector.resolve("requireService");
154154
requireService.require = (pathToRequire: string) => {
@@ -230,7 +230,7 @@ describe("extensibilityService", () => {
230230
npm.install = async (packageName: string, pathToSave: string, config?: any): Promise<any> => {
231231
assert.deepEqual(packageName, extensionNames[0]);
232232
isNpmInstallCalled = true;
233-
return [packageName];
233+
return { name: packageName };
234234
};
235235

236236
const expectedResults: IExtensionData[] = _.map(extensionNames, extensionName => ({ extensionName }));

0 commit comments

Comments
 (0)