Skip to content

Commit daf0540

Browse files
committed
perf(gen:test:main): lets get some concurrency/re-use going
1 parent 54d4ebd commit daf0540

File tree

1 file changed

+57
-25
lines changed

1 file changed

+57
-25
lines changed

src/test/main.test.js

Lines changed: 57 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ describe('angular-fullstack:app', function() {
130130

131131
describe('with a generated endpoint', function() {
132132
beforeEach(function() {
133-
getConfig(path.join(dir, '.yo-rc.json')).then(config => {
133+
return getConfig(path.join(dir, '.yo-rc.json')).then(config => {
134134
return runEndpointGen('foo', {config: config['generator-angular-fullstack']});
135135
});
136136
});
@@ -142,7 +142,7 @@ describe('angular-fullstack:app', function() {
142142

143143
describe('with a generated capitalized endpoint', function() {
144144
beforeEach(function() {
145-
getConfig(path.join(dir, '.yo-rc.json')).then(config => {
145+
return getConfig(path.join(dir, '.yo-rc.json')).then(config => {
146146
return runEndpointGen('Foo', {config: config['generator-angular-fullstack']});
147147
});
148148
});
@@ -154,7 +154,7 @@ describe('angular-fullstack:app', function() {
154154

155155
describe('with a generated path name endpoint', function() {
156156
beforeEach(function() {
157-
getConfig(path.join(dir, '.yo-rc.json')).then(config => {
157+
return getConfig(path.join(dir, '.yo-rc.json')).then(config => {
158158
return runEndpointGen('foo/bar', {config: config['generator-angular-fullstack']});
159159
});
160160
});
@@ -166,7 +166,7 @@ describe('angular-fullstack:app', function() {
166166

167167
describe('with a generated snake-case endpoint', function() {
168168
beforeEach(function() {
169-
getConfig(path.join(dir, '.yo-rc.json')).then(config => {
169+
return getConfig(path.join(dir, '.yo-rc.json')).then(config => {
170170
return runEndpointGen('foo-bar', {config: config['generator-angular-fullstack']});
171171
});
172172
});
@@ -189,8 +189,12 @@ describe('angular-fullstack:app', function() {
189189

190190
describe('default settings using existing `.yo-rc.json`', function() {
191191
var dir;
192+
var jscsResult;
193+
var lintResult;
194+
var clientTestResult;
195+
var serverTestResult;
192196

193-
beforeEach(function() {
197+
before(function() {
194198
return runGen(null, {
195199
copyConfigFile: true,
196200
options: {
@@ -199,6 +203,10 @@ describe('angular-fullstack:app', function() {
199203
}
200204
}).then(_dir => {
201205
dir = _dir;
206+
jscsResult = runCmd('grunt jscs');
207+
lintResult = runCmd('grunt jshint');
208+
clientTestResult = runCmd('grunt test:client');
209+
serverTestResult = runCmd('grunt test:server');
202210
});
203211
});
204212

@@ -209,24 +217,28 @@ describe('angular-fullstack:app', function() {
209217
});
210218

211219
it('passes JSCS', function() {
212-
return runCmd('grunt jscs').should.be.fulfilled();
220+
return jscsResult.should.be.fulfilled();
213221
});
214222

215223
it('passes JSHint', function() {
216-
return runCmd('grunt jshint').should.be.fulfilled();
224+
return lintResult.should.be.fulfilled();
217225
});
218226

219227
it('passes client tests', function() {
220-
return runCmd('grunt test:client').should.be.fulfilled();
228+
return clientTestResult.should.be.fulfilled();
221229
});
222230

223231
it('passes server tests', function() {
224-
return runCmd('grunt test:server').should.be.fulfilled();
232+
return serverTestResult.should.be.fulfilled();
225233
});
226234
});
227235

228236
describe('with TypeScript, Jade, Jasmine, LESS, & OAuth', function() {
229237
var dir;
238+
var jscsResult;
239+
var lintResult;
240+
var clientTestResult;
241+
var serverTestResult;
230242
var testOptions = {
231243
buildtool: 'grunt',
232244
transpiler: 'ts',
@@ -242,9 +254,13 @@ describe('angular-fullstack:app', function() {
242254
uibootstrap: true
243255
};
244256

245-
beforeEach(function() {
257+
before(function() {
246258
return runGen(testOptions).then(_dir => {
247259
dir = _dir;
260+
jscsResult = runCmd('grunt jscs');
261+
lintResult = runCmd('grunt tslint');
262+
clientTestResult = runCmd('grunt test:client');
263+
serverTestResult = runCmd('grunt test:server');
248264
});
249265
});
250266

@@ -255,24 +271,24 @@ describe('angular-fullstack:app', function() {
255271
});
256272

257273
it('passes JSCS', function() {
258-
return runCmd('grunt jscs').should.be.fulfilled();
274+
return jscsResult.should.be.fulfilled();
259275
});
260276

261277
it('passes lint', function() {
262-
return runCmd('grunt tslint').should.be.fulfilled();
278+
return lintResult.should.be.fulfilled();
263279
});
264280

265281
it('should run client tests successfully', function() {
266-
return runCmd('grunt test:client').should.be.fulfilled();
282+
return clientTestResult.should.be.fulfilled();
267283
});
268284

269285
it('should run server tests successfully', function() {
270-
return runCmd('grunt test:server').should.be.fulfilled();
286+
return serverTestResult.should.be.fulfilled();
271287
});
272288

273289
describe('with a generated endpoint', function() {
274290
beforeEach(function() {
275-
getConfig(path.join(dir, '.yo-rc.json')).then(config => {
291+
return getConfig(path.join(dir, '.yo-rc.json')).then(config => {
276292
return runEndpointGen('foo', {config: config['generator-angular-fullstack']});
277293
});
278294
});
@@ -295,6 +311,10 @@ describe('angular-fullstack:app', function() {
295311

296312
describe('with sequelize models, auth', function() {
297313
var dir;
314+
var jscsResult;
315+
var lintResult;
316+
var clientTestResult;
317+
var serverTestResult;
298318
var testOptions = {
299319
buildtool: 'grunt',
300320
transpiler: 'babel',
@@ -313,6 +333,10 @@ describe('angular-fullstack:app', function() {
313333
beforeEach(function() {
314334
return runGen(testOptions).then(_dir => {
315335
dir = _dir;
336+
jscsResult = runCmd('grunt jscs');
337+
lintResult = runCmd('grunt jshint');
338+
clientTestResult = runCmd('grunt test:client');
339+
serverTestResult = runCmd('grunt test:server');
316340
});
317341
});
318342

@@ -323,24 +347,24 @@ describe('angular-fullstack:app', function() {
323347
});
324348

325349
it('passes JSCS', function() {
326-
return runCmd('grunt jscs').should.be.fulfilled();
350+
return jscsResult.should.be.fulfilled();
327351
});
328352

329353
it('passes lint', function() {
330-
return runCmd('grunt jshint').should.be.fulfilled();
354+
return lintResult.should.be.fulfilled();
331355
});
332356

333357
it('should run client tests successfully', function() {
334-
return runCmd('grunt test:client').should.be.fulfilled();
358+
return clientTestResult.should.be.fulfilled();
335359
});
336360

337361
it('should run server tests successfully', function() {
338-
return runCmd('grunt test:server').should.be.fulfilled();
362+
return serverTestResult.should.be.fulfilled();
339363
});
340364

341365
describe('with a generated endpoint', function() {
342366
beforeEach(function() {
343-
getConfig(path.join(dir, '.yo-rc.json')).then(config => {
367+
return getConfig(path.join(dir, '.yo-rc.json')).then(config => {
344368
return runEndpointGen('foo', {config: config['generator-angular-fullstack']});
345369
});
346370
});
@@ -363,6 +387,10 @@ describe('angular-fullstack:app', function() {
363387

364388
describe('with TypeScript, Mocha + Chai (should) and no server options', function() {
365389
var dir;
390+
var jscsResult;
391+
var lintResult;
392+
var clientTestResult;
393+
var serverTestResult;
366394
var testOptions = {
367395
buildtool: 'grunt',
368396
transpiler: 'ts',
@@ -382,6 +410,10 @@ describe('angular-fullstack:app', function() {
382410
beforeEach(function() {
383411
return runGen(testOptions).then(_dir => {
384412
dir = _dir;
413+
jscsResult = runCmd('grunt jscs');
414+
lintResult = runCmd('grunt tslint');
415+
clientTestResult = runCmd('grunt test:client');
416+
serverTestResult = runCmd('grunt test:server');
385417
});
386418
});
387419

@@ -392,24 +424,24 @@ describe('angular-fullstack:app', function() {
392424
});
393425

394426
it('passes JSCS', function() {
395-
return runCmd('grunt jscs').should.be.fulfilled();
427+
return jscsResult.should.be.fulfilled();
396428
});
397429

398430
it('passes lint', function() {
399-
return runCmd('grunt tslint').should.be.fulfilled();
431+
return lintResult.should.be.fulfilled();
400432
});
401433

402434
it('should run client tests successfully', function() {
403-
return runCmd('grunt test:client').should.be.fulfilled();
435+
return clientTestResult.should.be.fulfilled();
404436
});
405437

406438
it('should run server tests successfully', function() {
407-
return runCmd('grunt test:server').should.be.fulfilled();
439+
return serverTestResult.should.be.fulfilled();
408440
});
409441

410442
describe('with a generated endpoint', function() {
411443
beforeEach(function() {
412-
getConfig(path.join(dir, '.yo-rc.json')).then(config => {
444+
return getConfig(path.join(dir, '.yo-rc.json')).then(config => {
413445
return runEndpointGen('foo', {config: config['generator-angular-fullstack']});
414446
});
415447
});

0 commit comments

Comments
 (0)