{"id":13460651,"url":"https://github.com/azer/prova","last_synced_at":"2025-04-05T03:09:51.934Z","repository":{"id":15087976,"uuid":"17814479","full_name":"azer/prova","owner":"azer","description":"Test runner based on Tape and Browserify","archived":false,"fork":false,"pushed_at":"2017-07-29T16:24:17.000Z","size":140,"stargazers_count":331,"open_issues_count":27,"forks_count":30,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-01T01:01:47.879Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/azer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-03-17T02:06:02.000Z","updated_at":"2024-12-23T05:13:47.000Z","dependencies_parsed_at":"2022-09-08T14:31:32.075Z","dependency_job_id":null,"html_url":"https://github.com/azer/prova","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fprova","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fprova/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fprova/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Fprova/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azer","download_url":"https://codeload.github.com/azer/prova/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247280272,"owners_count":20912967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T10:00:46.412Z","updated_at":"2025-04-05T03:09:51.920Z","avatar_url":"https://github.com/azer.png","language":"JavaScript","readme":"## prova\n\nNode \u0026 Browser Test runner based on [Tape](http://github.com/substack/tape) and [Browserify](http://github.com/substack/node-browserify).\n\nScreencasts: [node.gif](https://dl.dropboxusercontent.com/s/8yyepixc0bbtby3/prova-node.gif), [browser.gif](https://dl.dropboxusercontent.com/s/wtzt78riv7vcp7n/prova.gif), [both.gif](https://i.cloudup.com/4jGix1WEDH.gif), [headless browser](https://i.cloudup.com/lWWplVaKta.png)\n\nSlides: [slides.com/azer/prova](http://slides.com/azer/prova)\n\nFeatures and screenshots:\n\n* Embeds [Tape](http://github.com/substack/tape)\n* Comes with a builtin web app to run tests on browser, sourcemaps are enabled.\n* Outputs less when tests pass ([Node](https://i.cloudup.com/ausJApnH1v.png), [Browser](https://i.cloudup.com/OKebjyRMfU.png))\n* Outputs more when tests fail ([Node](https://i.cloudup.com/R8KQ8Qwspz.png), [Browser](https://i.cloudup.com/nA08e0s60b.png))\n* Browser app runs tests inside of an iframe [Screenshot](https://i.cloudup.com/5n8H9AqMrf.png)\n* Uses [watchify](https://github.com/substack/watchify) to observe file changes and restart browser tests. [GIF Screenshot](https://dl.dropboxusercontent.com/s/wtzt78riv7vcp7n/prova.gif)\n* Lets filtering test cases (e.g node test.js -g foobar)\n* Comes with [browser-launcher](https://github.com/substack/browser-launcher) for [launching browsers automatically and headless testing](#launching-browsers-and-headless-testing). ([Screenshot](https://i.cloudup.com/lWWplVaKta.png))\n* Clickable error stacks on the browser: [Screenshot](https://i.cloudup.com/42iYw0WnPP.gif)\n* Optional progress bar for slow tests. GIFs: [Node](https://i.cloudup.com/PJR44iZStH.gif) / [Browser](https://cldup.com/n5miJIEN2G.gif)\n\n## Install\n\n```bash\n$ npm install -g azer/prova\n```\n\n## Usage\n\nExample test:\n\n```js\nvar test = require('prova')\n\ntest('timing test', function (t) {\n  t.plan(2)\n\n  t.equal(typeof Date.now, 'function')\n  var start = Date.now()\n\n  setTimeout(function () {\n    t.equal(Date.now() - start, 100)\n  }, 100)\n})\n```\n\nIn Node, it will output:\n\n```\n$ node test.js\nPassed 1 test.\n```\n\nOr, in case it fails:\n\n![](https://i.cloudup.com/R8KQ8Qwspz.png)\n\n### In Browser\n\nTo run the tests in a web browser, just pass `-b` parameter:\n\n```bash\n$ node test.js -b\nVisit localhost:7559 with a browser to start running the tests.\n```\n\nThen visit `localhost:7559` in your web browser:\n\n![](https://i.cloudup.com/OKebjyRMfU.png)\n\nIn case it fails, it'll show:\n\n![](https://i.cloudup.com/nA08e0s60b.png)\n\nThe web app uses [watchify](http://github.com/substack/watchify) to monitor file changes.\nSo, you won't have to reload the page when you modify a source code.\n\nProva runs the tests inside of an iframe. In case you test some UI stuff, you can open the iframe\nby clicking the `\u003c` button on the right:\n\n![](https://i.cloudup.com/5n8H9AqMrf.png)\n\n### Multiple Tests\n\nProva comes with a command-line script when you install it globally;\n\n```bash\n$ npm install -g prova\n```\n\nAnd it allows you running multiple tests on both Node and browser;\n\n```bash\n$ prova test/foo.js test/bar.js\n```\n\n```bash\n$ prova test/**/*.js -b\n```\n\n### Launching Browsers and Headless Testing\n\nList the detected browsers;\n\n```bash\n$ prova -l\nAvailable Browsers: safari v7.0.2, chrome v34.0.1847.116, phantom v1.9.7\n```\n\nAnd launch after publishing the tests:\n\n```bash\n$ prova -b -l safari\n```\n\nIf your system has Xvfb, you can pass `-e` parameter to open the browser headlessly:\n\n```bash\n$ prova -b -l chrome -e\n```\n\nOr you can just run the tests on PhantomJS:\n\n```bash\n$ prova -b -l phantom\n```\n\nIf you get `no matches for` errors and you think that your system has that browser, try removing [browser-launcher](https://github.com/substack/browser-launcher)'s config:\n\n```bash\n$ rm /Users/azer/.config/browser-launcher/config.json\n```\n\n### Browserify Transforms\n\nProva automatically applies [bunch of transforms](https://github.com/azer/prova/blob/master/lib/browserify-transforms.js#L4) by looking at the file extension. If you'd like to use a transform that doesn't exist in Prova by default, you can choose it with a parameter;\n\n```bash\n$ node test -b -t coffeeify\n```\n\nMultiple transforms can be specified using comma;\n\n```bash\n$ node test -b -t coffeeify,brfs,foo,bar\n```\n\n### Browserify Plugins\n\nPass Browserify plugins passing `-u` or `--plugin` parameter;\n\n```bash\n$ node test -b --plugin foo\n```\n\nUse comma to separate multiple plugins;\n\n```bash\n$ node test -b --plugin foo,bar\n```\n\n### Custom Frame Documents\n\nWhen you're running the tests on the browser, Prova has an empty HTML template that loads and runs the JavaScript tests.\nYou can customize this HTML file with -f or --frame parameter:\n\n```js\n$ node test -b -f test.html\n```\n\nClick the arrow button on right middle to keep the frame open. You'll be seeing the HTML document and test results in the same screen.\n\n### Manually Restarting Browser Tests\n\nProva watches for changes and automatically restarts the browser tests (inside in an iframe) but in case you need, there is an endpoint for restarting all the tests by hitting an endpoint;\n\n```\n$ curl localhost:7559/restart\n```\n\n### Loading Assets\n\nYou may need to load your images, web workers etc. for testing. Prova allows you to load assets from your current directory via the `/assets/in` endpoint. Let's say you'd like to load a file called \"foobar.png\":\n\n```\n$ curl http://localhost:7559/assets/in/foobar.png\n```\n\nShould work for you.\n\n### HTTP Proxy\n\nHTTP proxying is pretty useful to by-pass cross-domain issues (CORS) on the browser. You can easily point a URL to another host using `-y` / `--http-proxy` parameters:\n\n```\n$ node test -b -y \"/my-api=http://localhost:8080\"\n```\n\nAssuming that you'll be running your tests on `:7559`, any requests to `/my-api` will be streamed through `localhost:8080` in the above example.\n\n## Command-line\n\n```\n      USAGE\n\n          prova [filenames] [options]\n\n      OPTIONS\n\n          -g     --grep         Run tests matching with given pattern\n\n          -b     --browser       Publishes the tests on 0.0.0.0:7559\n          -o     --port          Publish the tests on given port number.\n          -d     --hostname      Publish the tests on given hostname.\n          -l     --launch        List available browsers to launch or launch specified browser.\n          -e     --headless      Launch the browser headlessly. (Requires xvfb)\n          -r     --proxy         Launch the browser with specified proxy configuration.\n          -q     --quit          Shut down the browser server once all the tests are done.\n          -f     --frame         Specify a custom document to run tests on browser. e.g node test -b -f custom.html\n          -x     --exec          Execute given commmand before running the tests.\n          -y     --http-proxy    Proxy requests matching with given pattern to a target. e.g -y \"/images=localhost:8080\"\n\n          -t     --transform     Use given Browserify transforms. e.g node test -b -t coffeeify,brfs\n          -u     --plugin        Use given Browserify plugins. e.g node test -b -u foo,bar\n\n          -s     --progress      Show a progress bar. Useful when tests are running slow.\n\n          -p     --tap           Output original Tap output without modifying anything.\n\n          -C     --no-console    Disable showing browser console messages on command-line.\n\n          -v     --version       Show version and exit\n          -h     --help          Show help and exit\n                 --examples      Show example commands\n```\n\n## Example Commands\n\n```\n    EXAMPLES\n\n        1. Run the tests on NodeJS.\n\n           $ node test.js\n           $ node test\n           $ prova test/index.js\n           $ prova\n\n           All the above example commands will work same way. Prova assumes the filename of your test is either `test.js` or `test/index.js`\n\n       2. Publish the tests on localhost:7559, so you can run the tests on a web browser.\n\n          $ node test.js -b\n          $ prova test -b\n          $ prova -b\n\n       3. Publish the tests on given host and port.\n\n          $ node test.js -o 8080 -d foobar.net\n          $ prova test.js -o 8080 -d foobar.net\n\n       4. Publish the tests and launch a browser to automatically run the tests.\n\n          $ node test.js -b -l chrome\n          $ prova test.js -b -l chrome\n\n       5. List the browsers that can be launched automatically.\n\n          $ prova -l\n          $ node test.js -l\n\n       6. Run the tests with PhantomJS.\n\n          $ node test.js -b -l phantom\n          $ prova test.js -b -l phantom\n\n       7. Run only specified tests with PhantomJS.\n\n          $ node test.js -b -l phantom -g pattern\n          $ prova test.js -b -l phantom -g pattern\n\n       8. Launch Chrome headlessly using xvfb:\n\n          $ node test -b -l chrome -e\n          $ prova test -b -l chrome -e\n```\n","funding_links":[],"categories":["Testing Frameworks","Testing Frameworks [🔝](#readme)","Unit Testing","测试框架"],"sub_categories":["Frameworks","Other Frameworks","框架"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazer%2Fprova","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazer%2Fprova","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazer%2Fprova/lists"}