-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
70 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/bin/bash | ||
|
||
# Test for Sinon issue 1526 | ||
# REQUIREMENTS: phantomic has been installed | ||
# Example run from sinon dir: | ||
# git bisect bad master | ||
# git bisect good v2.0.0 | ||
# git bisect run ../git-bisect-scripts/sinon-1526.sh | ||
# ... | ||
# ec74e944173e53fd71afa19e073f1262448534b9 is the first bad commit | ||
|
||
artefact="browser-bundle-with-test.js" | ||
|
||
cat << EOF > 1526-test.js | ||
var stub = sinon.stub(); | ||
var shouldNotGetHere = false; | ||
stub.onFirstCall() | ||
.throws(); | ||
try { | ||
stub(); | ||
shouldNotGetHere = true; | ||
} catch(e) { | ||
console.log("OK"); | ||
} | ||
if(shouldNotGetHere) throw new Error("FAIL"); | ||
EOF | ||
|
||
|
||
build(){ | ||
npm install \ | ||
&& ./build.js \ | ||
&& cat pkg/sinon.js 1526-test.js > $artefact | ||
} | ||
|
||
clean(){ | ||
rm $artefact | ||
git reset --hard | ||
} | ||
|
||
|
||
do_test(){ | ||
phantomic $artefact | ||
} | ||
|
||
build | ||
|
||
# Ignore the results of this test if the build step failed | ||
if (( $? != 0 ));then | ||
echo "Build step erred! Skipping current commit to avoid false negatives ..." | ||
|
||
# Returning 125 in a script is equivalent to doing a `git bisect skip` on the CLI | ||
# See `git help bisect` for more info | ||
exit 125 | ||
fi | ||
|
||
do_test | ||
|
||
STATUS=$? | ||
|
||
if (( $STATUS == 0 )); then | ||
echo "Test OK" | ||
else | ||
echo "Test FAIL" | ||
fi | ||
|
||
exit $STATUS | ||
|