Skip to content

Commit

Permalink
fix(stats): Updated cli to only track on valid commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
jthoms1 committed Aug 2, 2016
1 parent cc4ee64 commit 9308577
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ Cli.run = function run(processArgv) {
});
}

// Gather stats on the current command execution
IonicStats.t();

var taskName = argv._[0];
var task = Cli.getTaskSettingsByName(taskName);
log.debug('Task:', task);
Expand All @@ -134,6 +131,9 @@ Cli.run = function run(processArgv) {

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

// Gather stats on the current command execution
IonicStats.t();

// Remove all possible task boolean options from the args
argv = optimist(rawCliArguments)
.boolean(booleanOptions)
Expand Down
9 changes: 9 additions & 0 deletions spec/cli.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,15 @@ describe('Cli', function() {
});
});

it('should not track stats for cli for a bogus command', function(done) {

IonicCli.run(['node', 'bin/ionic', 'helper'])
.then(function() {
expect(IonicStats.t).not.toHaveBeenCalled();
done();
});
});

it('should change cwd to project root for project tasks', function(done) {
var processArguments = ['node', 'bin/ionic', 'fake'];
var rawCliArguments = processArguments.slice(2);
Expand Down

0 comments on commit 9308577

Please sign in to comment.