Commit af1dc701 authored by Domenic Denicola's avatar Domenic Denicola

Use promise-tests 2.0.0 release to get rid of crazy Rakefile-fu.

parent 3c4b86aa
/node_modules /node_modules
/promise-tests
...@@ -2,6 +2,5 @@ ...@@ -2,6 +2,5 @@
/.npmignore /.npmignore
/browser/ /browser/
/node_modules/ /node_modules/
/promise-tests/
/Rakefile /Rakefile
/tests/ /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" directory "browser"
file "browser/rsvp.js" => ["browser", "lib/rsvp.js"] do file "browser/rsvp.js" => ["browser", "lib/rsvp.js"] do
...@@ -72,4 +29,4 @@ task :push => :dist do ...@@ -72,4 +29,4 @@ task :push => :dist do
sh "git commit -m 'Updates build artifacts'" sh "git commit -m 'Updates build artifacts'"
end end
task :default => [:browser, :test] task :default => [:browser]
...@@ -5,10 +5,11 @@ ...@@ -5,10 +5,11 @@
"main": "lib/rsvp.js", "main": "lib/rsvp.js",
"directories": { "lib": "lib" }, "directories": { "lib": "lib" },
"devDependencies": { "devDependencies": {
"jshint": "~0.9" "jshint": "~0.9",
"promise-tests": "2.0.0"
}, },
"scripts": { "scripts": {
"test": "rake", "test": "promise-tests all ./tests/test-adapter",
"lint": "jshint lib" "lint": "jshint lib"
}, },
"repository": { "repository": {
......
"use strict"; "use strict";
var Promise = require("../../../lib/rsvp").Promise; var Promise = require("../lib/rsvp").Promise;
exports.fulfilled = function(value) { exports.fulfilled = function(value) {
var promise = new Promise(); var promise = new Promise();
...@@ -27,5 +27,3 @@ exports.pending = function () { ...@@ -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