-
-
Save abovethewater/1984875 to your computer and use it in GitHub Desktop.
JSHamcrest 0.6.7 - Use JsMockito with NodeJS (patched for CommonJS Module 1.1 compliance)
This file contains 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
#!/bin/sh | |
# JsHamcrest v0.6.7 && JsMockito v1.0.4 | |
# Begin with an empty file. | |
echo > mockito.js | |
# Download and concatenate jshamcrest with jsmockito. | |
curl --silent --compressed \ | |
http://jshamcrest.destaquenet.com/jshamcrest.js \ | |
http://cloud.github.com/downloads/chrisleishman/jsmockito/jsmockito-1.0.4.js \ | |
> mockito.js | |
# Patch a few things: | |
# - Compliance with CommonJS Module 1.1 specification | |
# - Throw Error objects instead of String objects | |
# - Declare JsMockito locally using `var` | |
patch mockito.js <<EOF | |
1646c1646 | |
< JsMockito = { | |
--- | |
> var JsMockito = { | |
2235c2235 | |
< throw description.get(); | |
--- | |
> throw new Error(description.get()); | |
2266c2266 | |
< throw description.get(); | |
--- | |
> throw new Error(description.get()); | |
2347a2348,2353 | |
> | |
> exports.JsMockito = {}; | |
> JsMockito.Integration.importTo(exports.JsMockito); | |
> | |
> exports.JsHamcrest = {}; | |
> JsHamcrest.Integration.copyMembers(exports.JsHamcrest); | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment