Skip to content

Commit

Permalink
Merge pull request #242 from IgniteUI/mvenkov/goole-analytic
Browse files Browse the repository at this point in the history
fix: in installPackages method enable skipAnalytic
  • Loading branch information
bazal4o authored Apr 12, 2018
2 parents 837cc17 + e472ec7 commit c21d67a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 4 additions & 1 deletion lib/packages/PackageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ export class PackageManager {
let command: string;
let managerCommand: string;

const oldSkipAnalytic = config.skipAnalytic;
config.skipAnalytic = true;

managerCommand = this.getManager();
switch (managerCommand) {
case "npm":
Expand All @@ -85,9 +88,9 @@ export class PackageManager {
Util.log(`Packages installed successfully`);
}
config.packagesInstalled = true;
config.skipAnalytic = oldSkipAnalytic;
ProjectConfig.setConfig(config);
}

}

public static removePackage(packageName: string, verbose: boolean = false): boolean {
Expand Down
10 changes: 6 additions & 4 deletions spec/unit/packageManager-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ describe("Unit - Package Manager", () => {
});
it("Should run installPackages properly with error code", async done => {
spyOn(ProjectConfig, "getConfig").and.returnValue({
packagesInstalled: false
packagesInstalled: false,
skipAnalytic: false
});
spyOn(Util, "log");
spyOn(shell, "exec").and.returnValue({
Expand All @@ -201,12 +202,13 @@ describe("Unit - Package Manager", () => {
expect(Util.log).toHaveBeenCalledWith(`Error installing npm packages.`);
expect(Util.log).toHaveBeenCalledWith(`Example`);
expect(shell.exec).toHaveBeenCalledWith(`npm install --quiet`, {silent: true});
expect(ProjectConfig.setConfig).toHaveBeenCalledWith({packagesInstalled: true});
expect(ProjectConfig.setConfig).toHaveBeenCalledWith({packagesInstalled: true, skipAnalytic: false});
done();
});
it("Should run installPackages properly without error code", async done => {
spyOn(ProjectConfig, "getConfig").and.returnValue({
packagesInstalled: false
packagesInstalled: false,
skipAnalytic: true
});
spyOn(Util, "log");
spyOn(shell, "exec").and.returnValue({
Expand All @@ -219,7 +221,7 @@ describe("Unit - Package Manager", () => {
expect(Util.log).toHaveBeenCalledWith(`Installing npm packages`);
expect(Util.log).toHaveBeenCalledWith(`Packages installed successfully`);
expect(shell.exec).toHaveBeenCalledWith(`npm install --quiet`, {silent: true});
expect(ProjectConfig.setConfig).toHaveBeenCalledWith({packagesInstalled: true});
expect(ProjectConfig.setConfig).toHaveBeenCalledWith({packagesInstalled: true, skipAnalytic: true});
done();
});
it("Should run removePackage properly with error code", async done => {
Expand Down

0 comments on commit c21d67a

Please sign in to comment.