Skip to content

Commit 95152ce

Browse files
committed
test(gen): add grunt test:fast task to generator, for skipping e2e tests
1 parent a84f644 commit 95152ce

File tree

3 files changed

+51
-24
lines changed

3 files changed

+51
-24
lines changed

Gruntfile.js

+18
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ module.exports = function (grunt) {
5858
},
5959
all: ['Gruntfile.js', '*/index.js']
6060
},
61+
env: {
62+
fast: {
63+
SKIP_E2E: true
64+
}
65+
},
6166
mochaTest: {
6267
test: {
6368
src: [
@@ -252,6 +257,19 @@ module.exports = function (grunt) {
252257
'installFixtures',
253258
'mochaTest'
254259
]);
260+
grunt.registerTask('test', function(target, option) {
261+
if (target === 'fast') {
262+
grunt.task.run([
263+
'env:fast'
264+
]);
265+
}
266+
267+
return grunt.task.run([
268+
'updateFixtures',
269+
'installFixtures',
270+
'mochaTest'
271+
])
272+
});
255273

256274
grunt.registerTask('demo', [
257275
'clean:demo',

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"grunt-contrib-clean": "^0.6.0",
4343
"grunt-contrib-jshint": "^0.10.0",
4444
"grunt-conventional-changelog": "~1.0.0",
45+
"grunt-env": "^0.4.1",
4546
"grunt-mocha-test": "^0.11.0",
4647
"grunt-release": "~0.6.0",
4748
"load-grunt-tasks": "~0.2.0",

test/test-file-creation.js

+32-24
Original file line numberDiff line numberDiff line change
@@ -422,13 +422,15 @@ describe('angular-fullstack generator', function () {
422422
});
423423
});
424424

425-
it('should run e2e tests successfully', function(done) {
426-
runTest('grunt test:e2e', this, done, 240000);
427-
});
425+
if(!process.env.SKIP_E2E) {
426+
it('should run e2e tests successfully', function(done) {
427+
runTest('grunt test:e2e', this, done, 240000);
428+
});
428429

429-
it('should run e2e tests successfully for production app', function(done) {
430-
runTest('grunt test:e2e:prod', this, done, 240000);
431-
});
430+
it('should run e2e tests successfully for production app', function(done) {
431+
runTest('grunt test:e2e:prod', this, done, 240000);
432+
});
433+
}
432434
});
433435

434436
describe('with other preprocessors and oauth', function() {
@@ -491,13 +493,15 @@ describe('angular-fullstack generator', function () {
491493
});
492494
});
493495

494-
it('should run e2e tests successfully', function(done) {
495-
runTest('grunt test:e2e', this, done, 240000);
496-
});
496+
if(!process.env.SKIP_E2E) {
497+
it('should run e2e tests successfully', function (done) {
498+
runTest('grunt test:e2e', this, done, 240000);
499+
});
497500

498-
it('should run e2e tests successfully for production app', function(done) {
499-
runTest('grunt test:e2e:prod', this, done, 240000);
500-
});
501+
it('should run e2e tests successfully for production app', function (done) {
502+
runTest('grunt test:e2e:prod', this, done, 240000);
503+
});
504+
}
501505

502506
});
503507

@@ -563,13 +567,15 @@ describe('angular-fullstack generator', function () {
563567
});
564568
});
565569

566-
it('should run e2e tests successfully', function(done) {
567-
runTest('grunt test:e2e', this, done, 240000);
568-
});
570+
if(!process.env.SKIP_E2E) {
571+
it('should run e2e tests successfully', function (done) {
572+
runTest('grunt test:e2e', this, done, 240000);
573+
});
569574

570-
it('should run e2e tests successfully for production app', function(done) {
571-
runTest('grunt test:e2e:prod', this, done, 240000);
572-
});
575+
it('should run e2e tests successfully for production app', function (done) {
576+
runTest('grunt test:e2e:prod', this, done, 240000);
577+
});
578+
}
573579

574580
});
575581

@@ -622,13 +628,15 @@ describe('angular-fullstack generator', function () {
622628
});
623629
});
624630

625-
it('should run e2e tests successfully', function(done) {
626-
runTest('grunt test:e2e', this, done, 240000);
627-
});
631+
if(!process.env.SKIP_E2E) {
632+
it('should run e2e tests successfully', function (done) {
633+
runTest('grunt test:e2e', this, done, 240000);
634+
});
628635

629-
it('should run e2e tests successfully for production app', function(done) {
630-
runTest('grunt test:e2e:prod', this, done, 240000);
631-
});
636+
it('should run e2e tests successfully for production app', function (done) {
637+
runTest('grunt test:e2e:prod', this, done, 240000);
638+
});
639+
}
632640

633641
});
634642
});

0 commit comments

Comments
 (0)