Skip to content

Commit c30f9d8

Browse files
committed
fix(start): ensure that --no-ts flag provided to --v2 project start pulls the javascript version.
1 parent df20815 commit c30f9d8

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

lib/ionic/start.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function run(ionic, argv) {
6363
}
6464

6565
// If we are starting a version 2 project then typescript should be set by default
66-
if ((argv.v2 || argv.v) && !argv.ts && !argv.typescript) {
66+
if ((argv.v2 || argv.v) && !argv.hasOwnProperty('ts') && !argv.hasOwnProperty('typescript')) {
6767
argv.ts = true;
6868
}
6969

spec/tasks/start.spec.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,50 @@ describe('start command', function() {
178178
});
179179
});
180180

181+
it('should use javascript if starting a v2 project with --v2 and --no-ts', function(done) {
182+
var processArguments = ['node', 'ionic', 'start', 'newDir', '--v2', '--no-ts'];
183+
var rawCliArguments = processArguments.slice(2);
184+
var argv = optimist(rawCliArguments).argv;
185+
186+
spyOn(fs, 'existsSync').andReturn(false);
187+
spyOn(appLibUtils, 'preprocessCliOptions').andCallThrough();
188+
spyOn(Start, 'promptForOverwrite');
189+
spyOn(Start, 'startApp').andReturn(Q(true));
190+
spyOn(Start, 'printQuickHelp').andReturn(Q(true));
191+
spyOn(Start, 'promptLogin').andReturn(Q(true));
192+
193+
start.run({}, argv).then(function() {
194+
expect(appLibUtils.preprocessCliOptions.calls[0].args[0].v2).toEqual(true);
195+
expect(appLibUtils.preprocessCliOptions.calls[0].args[0].ts).toEqual(false);
196+
expect(log.info).toHaveBeenCalledWith(
197+
'\nNew to Ionic? Get started here: http://ionicframework.com/docs/v2/getting-started\n'
198+
);
199+
done();
200+
});
201+
});
202+
203+
it('should use javascript if starting a v2 project with --v2 and --no-typescript', function(done) {
204+
var processArguments = ['node', 'ionic', 'start', 'newDir', '--v2', '--no-typescript'];
205+
var rawCliArguments = processArguments.slice(2);
206+
var argv = optimist(rawCliArguments).argv;
207+
208+
spyOn(fs, 'existsSync').andReturn(false);
209+
spyOn(appLibUtils, 'preprocessCliOptions').andCallThrough();
210+
spyOn(Start, 'promptForOverwrite');
211+
spyOn(Start, 'startApp').andReturn(Q(true));
212+
spyOn(Start, 'printQuickHelp').andReturn(Q(true));
213+
spyOn(Start, 'promptLogin').andReturn(Q(true));
214+
215+
start.run({}, argv).then(function() {
216+
expect(appLibUtils.preprocessCliOptions.calls[0].args[0].v2).toEqual(true);
217+
expect(appLibUtils.preprocessCliOptions.calls[0].args[0].typescript).toEqual(false);
218+
expect(log.info).toHaveBeenCalledWith(
219+
'\nNew to Ionic? Get started here: http://ionicframework.com/docs/v2/getting-started\n'
220+
);
221+
done();
222+
});
223+
});
224+
181225
it('should catch error if any process throws', function(done) {
182226
var processArguments = ['node', 'ionic', 'start', 'newDir'];
183227
var rawCliArguments = processArguments.slice(2);

0 commit comments

Comments
 (0)