Skip to content

Commit

Permalink
chore(tests): add Promises/A+ Test Suite to the build
Browse files Browse the repository at this point in the history
  • Loading branch information
jamestalmage authored and IgorMinar committed Aug 22, 2013
1 parent 487e535 commit d3ce5bb
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ angular.xcodeproj
.agignore
libpeerconnection.log
npm-debug.log
/tmp/
26 changes: 24 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-ddescribe-iit');
grunt.loadNpmTasks('grunt-merge-conflict');
grunt.loadNpmTasks('grunt-parallel');
grunt.loadNpmTasks('grunt-shell');
grunt.loadTasks('lib/grunt');

var NG_VERSION = util.getVersion();
Expand All @@ -32,6 +33,7 @@ module.exports = function(grunt) {
},
tasks: [
{grunt: true, args: ['test:docgen']},
{grunt: true, args: ['test:promises-aplus']},
util.parallelTask('tests:docs'),
util.parallelTask('tests:modules'),
util.parallelTask('tests:jquery'),
Expand Down Expand Up @@ -104,7 +106,10 @@ module.exports = function(grunt) {
},


clean: {build: ['build']},
clean: {
build: ['build'],
tmp: ['tmp']
},


build: {
Expand Down Expand Up @@ -171,6 +176,10 @@ module.exports = function(grunt) {
cookies: {
dest: 'build/angular-cookies.js',
src: util.wrap(['src/ngCookies/cookies.js'], 'module')
},
"promises-aplus-adapter": {
dest:'tmp/promises-aplus-adapter++.js',
src:['src/ng/q.js','lib/promises-aplus/promises-aplus-test-adapter.js']
}
},

Expand Down Expand Up @@ -227,6 +236,18 @@ module.exports = function(grunt) {
}
},

shell:{
"promises-aplus-tests":{
options:{
//stdout:true,
stderr:true,
failOnError:true
},
command:'./node_modules/.bin/promises-aplus-tests tmp/promises-aplus-adapter++.js'
}

},


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


//alias tasks
grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['package','test:unit', 'tests:docs', 'test:e2e']);
grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['package','test:unit','test:promises-aplus', 'tests:docs', 'test:e2e']);
grunt.registerTask('test:jqlite', 'Run the unit tests with Karma' , ['tests:jqlite']);
grunt.registerTask('test:jquery', 'Run the jQuery unit tests with Karma', ['tests:jquery']);
grunt.registerTask('test:modules', 'Run the Karma module tests with Karma', ['tests:modules']);
grunt.registerTask('test:docs', 'Run the doc-page tests with Karma', ['package', 'tests:docs']);
grunt.registerTask('test:unit', 'Run unit, jQuery and Karma module tests with Karma', ['tests:jqlite', 'tests:jquery', 'tests:modules']);
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']);
grunt.registerTask('test:docgen', ['jasmine-node']);
grunt.registerTask('test:promises-aplus',['build:promises-aplus-adapter','shell:promises-aplus-tests']);

grunt.registerTask('minify', ['bower','clean', 'build', 'minall']);
grunt.registerTask('webserver', ['connect:devserver']);
Expand Down
15 changes: 15 additions & 0 deletions lib/promises-aplus/promises-aplus-test-adapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var isFunction = function isFunction(value){return typeof value == 'function';}

var $q = qFactory(process.nextTick, function noopExceptionHandler() {});

exports.fulfilled = $q.resolve;
exports.rejected = $q.reject;
exports.pending = function () {
var deferred = $q.defer();

return {
promise: deferred.promise,
fulfill: deferred.resolve,
reject: deferred.reject
};
};
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
"grunt-contrib-jasmine-node": "~0.1.1",
"grunt-parallel": "~0.3.0",
"grunt-ddescribe-iit": "~0.0.1",
"grunt-merge-conflict": "~0.0.1"
"grunt-merge-conflict": "~0.0.1",
"promises-aplus-tests": "~1.3.2",
"grunt-shell": "~0.3.1"
},
"licenses": [
{
Expand Down

0 comments on commit d3ce5bb

Please sign in to comment.