All Projects → jorgebucaran → Fishtape

jorgebucaran / Fishtape

Licence: mit
100% pure-Fish test runner.

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Fishtape

Zap
A streamable structured interface for real time reporting of developer tools.
Stars: ✭ 114 (-59.72%)
Mutual labels:  test, tap
Zora
Lightest, yet Fastest Javascript test runner for nodejs and browsers
Stars: ✭ 356 (+25.8%)
Mutual labels:  test, tap
cxx-tap
Test Anything Protocol (TAP) Producer for C++
Stars: ✭ 22 (-92.23%)
Mutual labels:  tap, test
Mini Test.c
Minimalistic portable test runner for C projects
Stars: ✭ 12 (-95.76%)
Mutual labels:  test, tap
node-bogota
🚀 Run tape tests concurrently with tap-spec output
Stars: ✭ 15 (-94.7%)
Mutual labels:  tap, test
robot-testing-framework
Robot Testing Framework (RTF)
Stars: ✭ 12 (-95.76%)
Mutual labels:  test
Fzf.fish
Augment your fish command line with fzf key bindings.
Stars: ✭ 255 (-9.89%)
Mutual labels:  fish
puppeteer-screenshot-tester
Small library that allows us to compare screenshots generated by puppeteer in our tests.
Stars: ✭ 50 (-82.33%)
Mutual labels:  test
xRetry
Retry running tests via Xunit and Specflow
Stars: ✭ 15 (-94.7%)
Mutual labels:  test
Aioresponses
Aioresponses is a helper for mock/fake web requests in python aiohttp package.
Stars: ✭ 278 (-1.77%)
Mutual labels:  test
Selenium Document
a document with regard to selenium
Stars: ✭ 274 (-3.18%)
Mutual labels:  test
Hover On Touch
A pure Javascript Plugin for an alternative hover function that works on mobile and desktop devices. It triggers a hover css class on »Taphold« and goes to a possible link on »Tap«. It works with all html elements.
Stars: ✭ 256 (-9.54%)
Mutual labels:  tap
dotfiles
My arch setup script and dotfiles
Stars: ✭ 37 (-86.93%)
Mutual labels:  fish
Tap Spec
Formatted TAP output like Mocha's spec reporter
Stars: ✭ 268 (-5.3%)
Mutual labels:  tap
fake-sftp-server-rule
A JUnit rule that runs an in-memory SFTP server.
Stars: ✭ 34 (-87.99%)
Mutual labels:  test
Fundle
A minimalist package manager for fish shell
Stars: ✭ 274 (-3.18%)
Mutual labels:  fish
change-tracker-plugin
A Gradle plugin to help analyse the dependency between modules and run tasks only on modules impacted by specific set of changes.
Stars: ✭ 103 (-63.6%)
Mutual labels:  test
zmock
zmock--http接口的mock平台
Stars: ✭ 98 (-65.37%)
Mutual labels:  test
Goreporter
A Golang tool that does static analysis, unit testing, code review and generate code quality report.
Stars: ✭ 2,943 (+939.93%)
Mutual labels:  test
worrms
World Register of Marine Species R client
Stars: ✭ 13 (-95.41%)
Mutual labels:  fish

Fishtape

100% pure-Fish test runner.

Fishtape is a Test Anything Protocol compliant test runner for Fish. Use it to test anything: scripts, functions, plugins without ever leaving your favorite shell. Here's the first example to get you started:

@test "has a config.fish file" -e ~/.config/fish/config.fish

@test "the ultimate question" (math "6 * 7") -eq 42

@test "got root?" $USER = root

Now put that in a fish file and run it with fishtape installed. Behold, the TAP stream!

$ fishtape example.fish
TAP version 13
ok 1 has a config.fish file
ok 2 the ultimate question
not ok 3 got root?
  ---
    operator: =
    expected: root
    actual: jb
    at: ~/fishtape/tests/example.fish:5
  ...

1..3
# pass 2
# fail 1

See reporting options for alternatives to TAP output.

Each test file runs inside its own shell, so you can modify the global environment without cluttering your session or breaking other tests. If all the tests pass, fishtape exits with 0 or 1 otherwise.

Installation

Install with Fisher:

fisher install jorgebucaran/fishtape

Writing Tests

Tests are defined with the @test function. Each test begins with a description, followed by a typical test expression. Refer to the test builtin documentation for operators and usage details.

@test description [actual] operator expected

Operators to combine expressions are not currently supported: -a, -o.

Sometimes you need to test the exit status of running one or more commands and for that, you use command substitutions. Just make sure to suppress stdout to avoid cluttering your test expression.

@test "repo is clean" (git diff-index --quiet @) $status -eq 0

Often you have work that needs to happen before and after tests run like preparing the environment and cleaning up after you're done. The best way to do this is directly in your test file.

set temp (mktemp -d)

cd $temp

@test "a regular file" (touch file) -f file
@test "nothing to see here" -z (read < file)

rm -rf $temp

When comparing multiline output you usually have two options, collapse newlines using echo or collect your input into a single argument with string collect. It's your call.

@test "first six evens" (echo (seq 2 2 12)) = "2 4 6 8 10 12"

@test "one two three" (seq 3 | string collect) = "1
2
3"

If you want to write to stdout while tests are running, use the @echo function. It's equivalent to echo "# $argv", which prints a TAP comment.

@echo -- strings --

Reporting Options

If you're looking for something fancier than plaintext, here's a list of reporters that you can pipe TAP into.

$ fishtape test/* | tnyan
 8   -_-_-_-__,------,
 0   -_-_-_-__|  /\_/\
 0   -_-_-_-_~|_( ^ .^)
     -_-_-_-_ ""  ""
  Pass!

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].