Last active
August 29, 2015 14:08
-
-
Save twasink/dc68f2f8884e8c77b221 to your computer and use it in GitHub Desktop.
Upgrade Jasmine 1.3 to Jasmine 2.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Before | |
it("test stuff", function() { | |
... | |
waitsFor(function() { | |
return flag | |
}, "should set tthe flag, meaning its entered the callback", 150) | |
runs(function() { | |
controller.removeEvent(evt.id) | |
}) | |
}) | |
After: | |
it("test stuff", function(done() { | |
... | |
var intervalId = setInterval(function() { | |
console.log("Checking flag") | |
if (flag) { | |
controller.removeEvent(evt.id); | |
console.log("clearing interval") | |
clearInterval(intervalId) | |
done() | |
} | |
}, 150) | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sed -i "" "s@[email protected]@g" `find */tests -name *Spec.js` | |
sed -i "" "s@[email protected]@g" `find */tests -name *Spec.js` | |
sed -i "" "s@[email protected]()@g" `find */tests -name *Spec.js` | |
sed -i "" "s@[email protected]@g" `find */tests -name *Spec.js` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This upgrades most of the raw syntax of Jasmine tests to 2.0.
What this can't do is upgrade the asynchronous tests - that's too big a change, as it's not just a mapping, but a fundamental change (particularly the loss of
run()
)