Skip to content

Instantly share code, notes, and snippets.

@wessmith
Created October 20, 2015 19:03
Show Gist options
  • Save wessmith/df5785625ed4a1025e8c to your computer and use it in GitHub Desktop.
Save wessmith/df5785625ed4a1025e8c to your computer and use it in GitHub Desktop.
Generate warnings when focusing tests with Specta
#!/bin/sh
FOCUS="fit\(|fdescribe\(|fcontext\("
find "${SRCROOT}/Path/To/Tests" \( -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($FOCUS).*\$" | perl -p -e "s/($FOCUS)/ warning: \$1/"
@briancroom
Copy link

Cedar's approach to this is to treat the overall test run as a failure if any tests are marked as focused. This lets a CI script flag the build if a commit slips through with a focused test.

https://github.com/pivotal/cedar/blob/master/Source/Reporters/CDRDefaultReporter.m#L63

@modocache
Copy link

@briancroom that's really neat. But when running via Xcode, does that display a "tests failed" overlay?

@wessmith
Copy link
Author

@modocache Love the idea of including it in Specta!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment