This repository has been archived by the owner on Jan 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
74 lines (65 loc) · 1.74 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
var gulp = require('gulp');
var notify = require('gulp-notify');
var phpspec = require('gulp-phpspec');
var phpunit = require('gulp-phpunit');
gulp.task('phpunit', function() {
var options = {
notify: true,
clear: true,
noInteraction: true,
formatter: "pretty",
"configurationFile": "./phpunit.xml"
};
gulp.src([
'src/Grandadevans/GenerateForm/Command/FormGeneratorCommand.php',
'tests/phpunit/Grandadevans/GenerateForm/Command/FormGenerateCommandTest.php'
])
.pipe(phpunit('phpunit', options))
.on('error', notify.onError({
title: "Testing Failed",
message: "Error(s) occurred during test..."
}))
.pipe(notify({
title: "Testing Passed",
message: "All tests have passed..."
})
);
});
gulp.task('phpspec', function() {
var options = {
notify: true,
clear: true,
noInteraction: true,
formatter: "pretty"
};
gulp.src(['tests/spec/**/*Spec.php','src/**/*'])
.pipe(phpspec('./vendor/bin/phpspec run', options))
.on('error', notify.onError({
title: "Testing Failed",
message: "Error(s) occurred during test..."
}))
.pipe(notify({
title: "Testing Passed",
message: "All tests have passed..."
}));
});
gulp.task('watch-phpunit', function () {
gulp.watch([
'src/Grandadevans/GenerateForm/Command/FormGeneratorCommand.php',
'tests/phpunit/Grandadevans/GenerateForm/Command/FormGenerateCommandTest.php'
], ['phpunit']);
});
gulp.task('watch-phpspec', function () {
gulp.watch([
'src/**/*',
'tests/spec/**/*'
], ['phpspec']);
});
gulp.task('notify-watching', function() {
gulp.src('./')
.pipe(notify({
title: 'Automatic testing ACTIVE',
message: 'Automatic testing for PHPUnit/PHPSpec files is ACTIVE.'
}));
});
gulp.task('default', ['notify-watching', 'watch-phpspec', 'watch-phpspec']);