Created
October 20, 2015 19:03
-
-
Save wessmith/df5785625ed4a1025e8c to your computer and use it in GitHub Desktop.
Generate warnings when focusing tests with Specta
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
#!/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/" |
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
@briancroom that's really neat. But when running via Xcode, does that display a "tests failed" overlay?
@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
This is awesome!! 😍
I wonder, should Specta define
fit
and friends as macros such that they could add#warning
pragmas? That would display warnings inline. Separate function definitions would have to be kept for Swift support, though.This might also make a great Clang plugin. /cc @kastiglione