Skip to content

Commit 9308577

Browse files
committed
fix(stats): Updated cli to only track on valid commands.
1 parent cc4ee64 commit 9308577

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

lib/cli.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,6 @@ Cli.run = function run(processArgv) {
119119
});
120120
}
121121

122-
// Gather stats on the current command execution
123-
IonicStats.t();
124-
125122
var taskName = argv._[0];
126123
var task = Cli.getTaskSettingsByName(taskName);
127124
log.debug('Task:', task);
@@ -134,6 +131,9 @@ Cli.run = function run(processArgv) {
134131

135132
var booleanOptions = Cli.getListOfBooleanOptions(task.options);
136133

134+
// Gather stats on the current command execution
135+
IonicStats.t();
136+
137137
// Remove all possible task boolean options from the args
138138
argv = optimist(rawCliArguments)
139139
.boolean(booleanOptions)

spec/cli.spec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,15 @@ describe('Cli', function() {
162162
});
163163
});
164164

165+
it('should not track stats for cli for a bogus command', function(done) {
166+
167+
IonicCli.run(['node', 'bin/ionic', 'helper'])
168+
.then(function() {
169+
expect(IonicStats.t).not.toHaveBeenCalled();
170+
done();
171+
});
172+
});
173+
165174
it('should change cwd to project root for project tasks', function(done) {
166175
var processArguments = ['node', 'bin/ionic', 'fake'];
167176
var rawCliArguments = processArguments.slice(2);

0 commit comments

Comments
 (0)