Skip to content

Commit 7050355

Browse files
jamestalmagejamesdaily
authored andcommitted
chore(tests): add Promises/A+ Test Suite to the build
Closes angular#3693
1 parent 33c8e19 commit 7050355

File tree

4 files changed

+42
-4
lines changed

4 files changed

+42
-4
lines changed

.gitignore

+1
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

+23-3
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();
@@ -28,7 +29,7 @@ module.exports = function(grunt) {
2829
parallel: {
2930
travis: {
3031
tasks: [
31-
util.parallelTask(['test:unit', 'test:docgen', 'tests:docs'], {stream: true}),
32+
util.parallelTask(['test:unit', 'test:docgen', 'test:promises-aplus', 'tests:docs'], {stream: true}),
3233
util.parallelTask(['test:e2e'])
3334
]
3435
}
@@ -97,7 +98,10 @@ module.exports = function(grunt) {
9798
},
9899

99100

100-
clean: {build: ['build']},
101+
clean: {
102+
build: ['build'],
103+
tmp: ['tmp']
104+
},
101105

102106

103107
build: {
@@ -164,6 +168,10 @@ module.exports = function(grunt) {
164168
cookies: {
165169
dest: 'build/angular-cookies.js',
166170
src: util.wrap(['src/ngCookies/cookies.js'], 'module')
171+
},
172+
"promises-aplus-adapter": {
173+
dest:'tmp/promises-aplus-adapter++.js',
174+
src:['src/ng/q.js','lib/promises-aplus/promises-aplus-test-adapter.js']
167175
}
168176
},
169177

@@ -220,6 +228,17 @@ module.exports = function(grunt) {
220228
}
221229
},
222230

231+
shell:{
232+
"promises-aplus-tests":{
233+
options:{
234+
//stdout:true,
235+
stderr:true,
236+
failOnError:true
237+
},
238+
command:'./node_modules/.bin/promises-aplus-tests tmp/promises-aplus-adapter++.js'
239+
}
240+
},
241+
223242

224243
write: {
225244
versionTXT: {file: 'build/version.txt', val: NG_VERSION.full},
@@ -229,14 +248,15 @@ module.exports = function(grunt) {
229248

230249

231250
//alias tasks
232-
grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['package','test:unit', 'tests:docs', 'test:e2e']);
251+
grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['package','test:unit','test:promises-aplus', 'tests:docs', 'test:e2e']);
233252
grunt.registerTask('test:jqlite', 'Run the unit tests with Karma' , ['tests:jqlite']);
234253
grunt.registerTask('test:jquery', 'Run the jQuery unit tests with Karma', ['tests:jquery']);
235254
grunt.registerTask('test:modules', 'Run the Karma module tests with Karma', ['tests:modules']);
236255
grunt.registerTask('test:docs', 'Run the doc-page tests with Karma', ['package', 'tests:docs']);
237256
grunt.registerTask('test:unit', 'Run unit, jQuery and Karma module tests with Karma', ['tests:jqlite', 'tests:jquery', 'tests:modules']);
238257
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']);
239258
grunt.registerTask('test:docgen', ['jasmine-node']);
259+
grunt.registerTask('test:promises-aplus',['build:promises-aplus-adapter','shell:promises-aplus-tests']);
240260

241261
grunt.registerTask('minify', ['bower','clean', 'build', 'minall']);
242262
grunt.registerTask('webserver', ['connect:devserver']);
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

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
"grunt-contrib-jasmine-node": "~0.1.1",
3434
"grunt-parallel": "git://github.com/vojtajina/grunt-parallel.git#streaming-per-task",
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)