Skip to content

Commit d3ce5bb

Browse files
jamestalmageIgorMinar
authored andcommitted
chore(tests): add Promises/A+ Test Suite to the build
Closes angular#3693
1 parent 487e535 commit d3ce5bb

File tree

4 files changed

+43
-3
lines changed

4 files changed

+43
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ angular.xcodeproj
1515
.agignore
1616
libpeerconnection.log
1717
npm-debug.log
18+
/tmp/

Gruntfile.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module.exports = function(grunt) {
1111
grunt.loadNpmTasks('grunt-ddescribe-iit');
1212
grunt.loadNpmTasks('grunt-merge-conflict');
1313
grunt.loadNpmTasks('grunt-parallel');
14+
grunt.loadNpmTasks('grunt-shell');
1415
grunt.loadTasks('lib/grunt');
1516

1617
var NG_VERSION = util.getVersion();
@@ -32,6 +33,7 @@ module.exports = function(grunt) {
3233
},
3334
tasks: [
3435
{grunt: true, args: ['test:docgen']},
36+
{grunt: true, args: ['test:promises-aplus']},
3537
util.parallelTask('tests:docs'),
3638
util.parallelTask('tests:modules'),
3739
util.parallelTask('tests:jquery'),
@@ -104,7 +106,10 @@ module.exports = function(grunt) {
104106
},
105107

106108

107-
clean: {build: ['build']},
109+
clean: {
110+
build: ['build'],
111+
tmp: ['tmp']
112+
},
108113

109114

110115
build: {
@@ -171,6 +176,10 @@ module.exports = function(grunt) {
171176
cookies: {
172177
dest: 'build/angular-cookies.js',
173178
src: util.wrap(['src/ngCookies/cookies.js'], 'module')
179+
},
180+
"promises-aplus-adapter": {
181+
dest:'tmp/promises-aplus-adapter++.js',
182+
src:['src/ng/q.js','lib/promises-aplus/promises-aplus-test-adapter.js']
174183
}
175184
},
176185

@@ -227,6 +236,18 @@ module.exports = function(grunt) {
227236
}
228237
},
229238

239+
shell:{
240+
"promises-aplus-tests":{
241+
options:{
242+
//stdout:true,
243+
stderr:true,
244+
failOnError:true
245+
},
246+
command:'./node_modules/.bin/promises-aplus-tests tmp/promises-aplus-adapter++.js'
247+
}
248+
249+
},
250+
230251

231252
write: {
232253
versionTXT: {file: 'build/version.txt', val: NG_VERSION.full},
@@ -236,14 +257,15 @@ module.exports = function(grunt) {
236257

237258

238259
//alias tasks
239-
grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['package','test:unit', 'tests:docs', 'test:e2e']);
260+
grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['package','test:unit','test:promises-aplus', 'tests:docs', 'test:e2e']);
240261
grunt.registerTask('test:jqlite', 'Run the unit tests with Karma' , ['tests:jqlite']);
241262
grunt.registerTask('test:jquery', 'Run the jQuery unit tests with Karma', ['tests:jquery']);
242263
grunt.registerTask('test:modules', 'Run the Karma module tests with Karma', ['tests:modules']);
243264
grunt.registerTask('test:docs', 'Run the doc-page tests with Karma', ['package', 'tests:docs']);
244265
grunt.registerTask('test:unit', 'Run unit, jQuery and Karma module tests with Karma', ['tests:jqlite', 'tests:jquery', 'tests:modules']);
245266
grunt.registerTask('test:e2e', 'Run the end to end tests with Karma and keep a test server running in the background', ['connect:testserver', 'tests:end2end']);
246267
grunt.registerTask('test:docgen', ['jasmine-node']);
268+
grunt.registerTask('test:promises-aplus',['build:promises-aplus-adapter','shell:promises-aplus-tests']);
247269

248270
grunt.registerTask('minify', ['bower','clean', 'build', 'minall']);
249271
grunt.registerTask('webserver', ['connect:devserver']);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
var isFunction = function isFunction(value){return typeof value == 'function';}
2+
3+
var $q = qFactory(process.nextTick, function noopExceptionHandler() {});
4+
5+
exports.fulfilled = $q.resolve;
6+
exports.rejected = $q.reject;
7+
exports.pending = function () {
8+
var deferred = $q.defer();
9+
10+
return {
11+
promise: deferred.promise,
12+
fulfill: deferred.resolve,
13+
reject: deferred.reject
14+
};
15+
};

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
"grunt-contrib-jasmine-node": "~0.1.1",
3434
"grunt-parallel": "~0.3.0",
3535
"grunt-ddescribe-iit": "~0.0.1",
36-
"grunt-merge-conflict": "~0.0.1"
36+
"grunt-merge-conflict": "~0.0.1",
37+
"promises-aplus-tests": "~1.3.2",
38+
"grunt-shell": "~0.3.1"
3739
},
3840
"licenses": [
3941
{

0 commit comments

Comments
 (0)