-
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.
Add patch for mocha test runner colors
- Loading branch information
Showing
2 changed files
with
45 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,12 @@ | ||
--- _mocha | ||
+++ _mocha | ||
@@ -1,3 +1,9 @@ | ||
+// Fix expected/actual colors with Solarized | ||
+// https://github.com/mochajs/mocha/issues/1200#issuecomment-62780003 | ||
+var colors = require('../lib/reporters/base').colors; | ||
+colors['diff added'] = '32;40'; | ||
+colors['diff removed'] = '32;40'; | ||
+ | ||
/** | ||
* Module dependencies. | ||
*/ |
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,33 @@ | ||
#!/bin/bash | ||
|
||
_mocha=$(which _mocha) | ||
|
||
if [ ! -r "$_mocha" ]; then | ||
# _mocha executable not present | ||
exit | ||
fi | ||
|
||
if head -n 1 "$_mocha" | grep -q Solarized; then | ||
# _mocha executable already patched | ||
exit | ||
fi | ||
|
||
# resolve any symlinks in path to _mocha - otherwise patch will change _mocha | ||
# from a symlink to a regular file, and Node.js require will not work properly | ||
while [ -L "$_mocha" ]; do | ||
pushd "$(dirname "$_mocha")" > /dev/null | ||
pushd "$(dirname "$(readlink "$_mocha")")" > /dev/null | ||
_mocha="$(pwd)/_mocha" | ||
popd > /dev/null | ||
popd > /dev/null | ||
done | ||
|
||
if [ ! -w "$_mocha" ]; then | ||
# cannot write to _mocha executable | ||
echo "WARNING: Failed to patch _mocha ($_mocha) - try this:" | ||
echo " sudo $0" | ||
exit | ||
fi | ||
|
||
cd "$(dirname "$0")" | ||
patch --directory "$(dirname "$_mocha")" -p0 < mocha.diff |