Commit df1d9ba7 authored by Yehuda Katz's avatar Yehuda Katz

Merge pull request #13 from domenic/promise-tests

Use promise-tests 2.0.0 release to get rid of crazy Rakefile-fu.
parents 3c4b86aa af1dc701
/node_modules
/promise-tests
......@@ -2,6 +2,5 @@
/.npmignore
/browser/
/node_modules/
/promise-tests/
/Rakefile
/tests/
def replace_adapter(filename)
contents = File.read(filename)
regex = Regexp.new("^" + Regexp.escape(%{var adapter = require("./adapters/q");}) + "$")
replacement = %{var adapter = require("./adapters/rsvp");}
open(filename, "w") do |file|
file.write contents.gsub(regex, replacement)
end
end
file "promise-tests" do
sh "git clone https://github.com/domenic/promise-tests.git"
end
task :update do
cd "promise-tests" do
sh "git reset --hard origin/master"
sh "git pull"
sh "npm install"
end
end
file "promise-tests/lib/adapters/rsvp.js" => ["promise-tests", :update] do
cp "tests/test-adapter.js", "promise-tests/lib/adapters/rsvp.js"
end
task :prepare_tests => "promise-tests/lib/adapters/rsvp.js"
%w(promises-a.js always-async.js resolution-races.js returning-a-promise.js).each do |test|
file test => "promise-tests/lib/adapters/rsvp.js" do
replace_adapter("promise-tests/lib/#{test}")
end
task :prepare_tests => test
end
task :test => :prepare_tests do
cd "promise-tests" do
sh "./node_modules/mocha/bin/mocha lib/promises-a.js lib/always-async.js lib/resolution-races.js lib/returning-a-promise.js --reporter spec"
end
end
directory "browser"
file "browser/rsvp.js" => ["browser", "lib/rsvp.js"] do
......@@ -72,4 +29,4 @@ task :push => :dist do
sh "git commit -m 'Updates build artifacts'"
end
task :default => [:browser, :test]
task :default => [:browser]
......@@ -5,10 +5,11 @@
"main": "lib/rsvp.js",
"directories": { "lib": "lib" },
"devDependencies": {
"jshint": "~0.9"
"jshint": "~0.9",
"promise-tests": "2.0.0"
},
"scripts": {
"test": "rake",
"test": "promise-tests all ./tests/test-adapter",
"lint": "jshint lib"
},
"repository": {
......
"use strict";
var Promise = require("../../../lib/rsvp").Promise;
var Promise = require("../lib/rsvp").Promise;
exports.fulfilled = function(value) {
var promise = new Promise();
......@@ -27,5 +27,3 @@ exports.pending = function () {
}
};
};
exports.throws = true;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment