{"_id":"urchin","_rev":"2892858","name":"urchin","description":"Test framework for shell","dist-tags":{"latest":"0.0.5"},"maintainers":[{"name":"npm","email":""}],"time":{"modified":"2022-11-28T08:50:49.000Z","created":"2013-06-19T23:00:16.364Z","0.0.5":"2014-12-08T02:10:23.486Z","0.0.4":"2014-11-05T17:51:22.009Z","0.0.3":"2014-11-05T17:40:04.368Z","0.0.2":"2013-07-26T11:53:57.100Z","0.0.1":"2013-06-19T23:11:01.893Z","0.0.0":"2013-06-19T23:00:16.364Z"},"users":{},"author":{"name":"Thomas Levine","email":"_@thomaslevine.com"},"repository":{"type":"git","url":"git://github.com/tlevine/urchin.git"},"versions":{"0.0.5":{"name":"urchin","version":"0.0.5","description":"Test framework for shell","main":"urchin","directories":{"test":"tests"},"scripts":{"test":"export PATH=\"$PWD:$PATH\" && urchin tests"},"bin":{"urchin":"./urchin"},"repository":{"type":"git","url":"git://github.com/tlevine/urchin.git"},"keywords":["shell","test","testing"],"author":{"name":"Thomas Levine","email":"_@thomaslevine.com"},"contributors":[{"name":"Thomas Levine","email":"_@thomaslevine.com"},{"name":"David Jones","email":"drj@pobox.com"},{"name":"Francis Irving","email":"francis@flourish.org"},{"name":"Zarino Zappia","email":"mail@zarino.co.uk"},{"name":"Tom Mortimer-Jones","email":"tom@morty.co.uk"},{"name":"Michael Klement","email":"mklement0@gmail.com"}],"license":"BSD","gitHead":"f01869fb97687794cc415bc7a5357b03a2afc467","bugs":{"url":"https://github.com/tlevine/urchin/issues"},"homepage":"https://github.com/tlevine/urchin","_id":"urchin@0.0.5","_shasum":"4fddd7b0f83a131ca027c8126654324b3591d1fe","_from":".","_npmVersion":"2.1.8","_nodeVersion":"0.10.33","_npmUser":{"name":"tlevine","email":"_@thomaslevine.com"},"maintainers":[{"name":"npm","email":""}],"dist":{"shasum":"4fddd7b0f83a131ca027c8126654324b3591d1fe","size":10059,"noattachment":false,"key":"/urchin/-/urchin-0.0.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/urchin/download/urchin-0.0.5.tgz"},"_cnpmcore_publish_time":"2021-12-23T19:51:34.396Z","deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","publish_time":1418004623486,"_cnpm_publish_time":1418004623486},"0.0.4":{"name":"urchin","version":"0.0.4","description":"Test framework for shell","main":"urchin","directories":{"test":"tests"},"scripts":{"test":"export PATH=\"$PWD:$PATH\" && urchin tests"},"bin":{"urchin":"./urchin"},"repository":{"type":"git","url":"git://github.com/tlevine/urchin.git"},"keywords":["shell","test","testing"],"author":{"name":"Thomas Levine","email":"_@thomaslevine.com"},"license":"BSD","gitHead":"90abc2640d46221c1640c26d32afb44bb91257ce","bugs":{"url":"https://github.com/tlevine/urchin/issues"},"homepage":"https://github.com/tlevine/urchin","_id":"urchin@0.0.4","_shasum":"4b31c2089e2b17cee0b5b8666274ede93660659f","_from":".","_npmVersion":"2.1.4","_nodeVersion":"0.10.32","_npmUser":{"name":"tlevine","email":"_@thomaslevine.com"},"maintainers":[{"name":"npm","email":""}],"dist":{"shasum":"4b31c2089e2b17cee0b5b8666274ede93660659f","size":9532,"noattachment":false,"key":"/urchin/-/urchin-0.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/urchin/download/urchin-0.0.4.tgz"},"_cnpmcore_publish_time":"2021-12-23T19:51:34.089Z","deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","publish_time":1415209882009,"_cnpm_publish_time":1415209882009},"0.0.3":{"name":"urchin","version":"0.0.3","description":"Test framework for shell","main":"urchin","directories":{"test":"tests"},"scripts":{"test":"export PATH=\"$PWD:$PATH\" && urchin tests"},"bin":{"urchin":"./urchin"},"repository":{"type":"git","url":"git://github.com/tlevine/urchin.git"},"keywords":["shell","test","testing"],"author":{"name":"Thomas Levine","email":"_@thomaslevine.com"},"license":"BSD","gitHead":"bb41d5a15670d74f9f4f19efca6d454849e67cb3","bugs":{"url":"https://github.com/tlevine/urchin/issues"},"homepage":"https://github.com/tlevine/urchin","_id":"urchin@0.0.3","_shasum":"6ee140e53a72e8fbbd8e0777bb0b09bef6fce0fe","_from":".","_npmVersion":"2.1.4","_nodeVersion":"0.10.32","_npmUser":{"name":"tlevine","email":"_@thomaslevine.com"},"maintainers":[{"name":"npm","email":""}],"dist":{"shasum":"6ee140e53a72e8fbbd8e0777bb0b09bef6fce0fe","size":9377,"noattachment":false,"key":"/urchin/-/urchin-0.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/urchin/download/urchin-0.0.3.tgz"},"_cnpmcore_publish_time":"2021-12-23T19:51:33.194Z","deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","publish_time":1415209204368,"_cnpm_publish_time":1415209204368},"0.0.2":{"name":"urchin","version":"0.0.2","description":"Test framework for shell","main":"urchin","directories":{"test":"tests"},"scripts":{"test":"./urchin tests"},"bin":{"urchin":"./urchin"},"repository":{"type":"git","url":"git://github.com/scraperwiki/urchin.git"},"keywords":["shell","test","testing"],"author":{"name":"ScraperWiki Limited","email":"feedback@scraperwiki.com"},"license":"BSD","gitHead":"015052dcfd7152a0df037bef1bc5452e0c956695","_id":"urchin@0.0.2","dist":{"shasum":"636461e40545e475fa55467b65aac9f0e629d9ee","size":6536,"noattachment":false,"key":"/urchin/-/urchin-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/urchin/download/urchin-0.0.2.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"scraperwiki","email":"npm@scraperwiki.com"},"maintainers":[{"name":"npm","email":""}],"_cnpmcore_publish_time":"2021-12-23T19:51:32.319Z","deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","publish_time":1374839637100,"_cnpm_publish_time":1374839637100},"0.0.1":{"name":"urchin","version":"0.0.1","description":"Test framework for shell","main":"urchin","directories":{"test":"tests"},"scripts":{"test":"./urchin tests"},"bin":{"urchin":"./urchin"},"repository":{"type":"git","url":"git://github.com/scraperwiki/urchin.git"},"keywords":["shell","test","testing"],"author":{"name":"ScraperWiki Limited","email":"feedback@scraperwiki.com"},"license":"BSD","gitHead":"015052dcfd7152a0df037bef1bc5452e0c956695","_id":"urchin@0.0.1","dist":{"shasum":"611a44882b52ef5ad7318c9012f60b835ed3e8c0","size":5814,"noattachment":false,"key":"/urchin/-/urchin-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/urchin/download/urchin-0.0.1.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"scraperwiki","email":"npm@scraperwiki.com"},"maintainers":[{"name":"npm","email":""}],"_cnpmcore_publish_time":"2021-12-23T19:51:31.442Z","deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","publish_time":1371683461893,"_cnpm_publish_time":1371683461893},"0.0.0":{"name":"urchin","version":"0.0.0","description":"Test framework for shell","main":"urchin","directories":{"test":"tests"},"scripts":{"test":"./urchin tests"},"repository":{"type":"git","url":"git://github.com/scraperwiki/urchin.git"},"keywords":["shell","test","testing"],"author":{"name":"ScraperWiki Limited","email":"feedback@scraperwiki.com"},"license":"BSD","gitHead":"015052dcfd7152a0df037bef1bc5452e0c956695","_id":"urchin@0.0.0","dist":{"shasum":"c97712595b990dbb2308fdee9e26e34d597db226","size":5810,"noattachment":false,"key":"/urchin/-/urchin-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/urchin/download/urchin-0.0.0.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"scraperwiki","email":"npm@scraperwiki.com"},"maintainers":[{"name":"npm","email":""}],"_cnpmcore_publish_time":"2021-12-23T19:51:30.564Z","deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","publish_time":1371682816364,"_cnpm_publish_time":1371682816364}},"readme":"                       __    _     \n      __  ____________/ /_  (_)___ \n     / / / / ___/ ___/ __ \\/ / __ \\\n    / /_/ / /  / /__/ / / / / / / /\n    \\__,_/_/   \\___/_/ /_/_/_/ /_/ \n\nUrchin is a test framework for shell. It is implemented in\nportable /bin/sh and should work on GNU/Linux, Mac OS X, and\nother Unix platforms.\n\n## Try it out\nUrchin's tests are written in Urchin, so you can run them to see what Urchin\nis like. Clone the repository\n\n    git clone git://github.com/tlevine/urchin.git\n\nRun the tests\n\n    cd urchin\n    ./urchin tests\n\nThe above command will run the tests in your system's default\nshell, /bin/sh (on recent Ubuntu this is dash, but it could be\nksh or bash on other systems); to test urchin's cross-shell compatibility,\nrun this:\n\n    cd urchin\n    ./cross-shell-tests\n\n## Globally\nDownload Urchin like so (as root) (or use npm, below):\n\n    cd /usr/local/bin\n    wget https://raw.github.com/tlevine/urchin/master/urchin\n    chmod +x urchin\n\nCan be installed with npm too:\n\n    npm install -g urchin\n\nNow you can run it.\n\n    urchin <test directory>\n\nRun `urchin -h` to get command-line help.\n\n## Writing tests\nMake a root directory for your tests. Inside it, put executable files that\nexit `0` on success and something else on fail. Non-executable files and hidden\nfiles (dotfiles) are ignored, so you can store fixtures right next to your\ntests. Run urchin from inside the tests directory.\n\nUrchin only cares about the exit status, so you can actually write your tests\nin any language, not just shell.\n\n## More about writing tests\nTests are organized recursively in directories, where the names of the files\nand directories have special meanings.\n\n    tests/\n      setup\n      setup_dir\n      bar/\n        setup\n        test_that_something_works\n        teardown\n      baz/\n        jack-in-the-box/\n          setup\n          test_that_something_works\n          teardown\n        cat-in-the-box/\n          fixtures/\n            thingy.pdf\n          test_thingy\n      teardown\n\nDirectories are processed in a depth-first order. When a particular directory\nis processed, `setup_dir` is run before everything else in the directory, including\nsubdirectories. `teardown_dir` is run after everything else in the directory.\n\nA directory's `setup` file, if it exists, is run right before each test file\nwithin the particular directory, and the `teardown` file is run right after.\n\nFiles are only run if they are executable, and files beginning with `.` are\nignored. Thus, fixtures and libraries can be included sloppily within the test\ndirectory tree. The test passes if the file exits 0; otherwise, it fails.\n\n### Writing cross-shell compatibility tests for testing shell code\n\nWhile you could write your test scripts to explicitly invoke the functionality\nto test with various shells, Urchin facilitates a more flexible approach.\n\nThe specific approach depends on your test scenario:\n\n* (a) Your test scripts _invoke_ scripts containing portable shell code.\n* (b) Your scripts _source_ scripts containing portable shell code.\n\n#### (a) Cross-shell tests with test scripts that _invoke_ shell scripts\n\nIn your test scripts, invoke the shell scripts to test via the shell\nspecified in environment variable `TEST_SHELL` rather than directly;\ne.g.: `$TEST_SHELL ../foo bar` (rather than just `../foo bar`).  \nNote that if you alsow want your test scripts to work when run directly,\noutside of Urchin, be sure to target scripts that happen to be in the \ncurrent directory with prefix `./`; e.g., `$TEST_SHELL ./baz`\n(rather than `$TEST_SHELL baz`).\n\nThen, on invocation of Urchin, prepend a definition of environment variable\n`TEST_SHELL` specifying the shell to test with, e.g.: `TEST_SHELL=zsh urchin ./tests`.  \nTo test with multiple shells in sequence, use something like:\n\n    for shell in sh bash ksh zsh; do\n      TEST_SHELL=$shell urchin ./tests\n    done\n\nIf `TEST_SHELL` has no value, Urchin defines it as `/bin/sh`, so the test\nscripts can rely on `$TEST_SHELL` always containing a value.\n\n#### (b) Cross-shell tests with test scripts that _source_ shell scripts\n\nIf you _source_ shell code in your test scripts, it is the test scripts\nthemselves that must be run with the shell specified.\n\nTo that end, Urchin supports the `-s <shell>` option, which instructs\nUrchin to invoke the test scripts with the specified shell; e.g., `-s bash`.  \n(In addition, Urchin sets environment variable `TEST_SHELL` to the specified\nshell.)\n\nNote that only test scripts that either have no shebang line at all or\nhave shebang line `#!/bin/sh` are invoked with the specified shell.\nThis allows non-shell test scripts or test scripts for specific\nshells to coexist with those whose invocation should be controlled by `-s`.\n\nTo test with multiple shells in sequence, use something like:\n\n    for shell in sh bash ksh zsh; do\n      urchin -s $shell ./tests\n    done\n\n<!--\n#### (c) Cross shell tests with `urchin -x` (experimental)\nIf you run urchin with the `-x` flag, it will be as if you ran\n`$TEST_SHELL`. Unless `$TEST_SHELL` isn't set, in which case it'll\nbe as if you ran `/bin/sh`. Putting this in she shebang line might\neventually work out to be a cleaner way of doing cross-shell testing.\n\n    #!/usr/bin/env urchin -x\n    test a = a\n\nIt might make sense if you do this.\n\n    export TEST_SHELL=zsh && urchin -x\n    export TEST_SHELL=bash && urchin -x\n-->\n## Alternatives to Urchin\nAlternatives to Urchin are discussed in\n[this blog post](https://blog.scraperwiki.com/2012/12/how-to-test-shell-scripts/).\n","_attachments":{},"homepage":"https://github.com/tlevine/urchin","bugs":{"url":"https://github.com/tlevine/urchin/issues"},"license":"BSD"}