{"id":18304592,"url":"https://github.com/numtel/tinytest-in-app","last_synced_at":"2025-04-05T15:31:21.720Z","repository":{"id":21953837,"uuid":"25278407","full_name":"numtel/tinytest-in-app","owner":"numtel","description":"Use Tinytest to test a Meteor application","archived":false,"fork":false,"pushed_at":"2014-12-13T01:24:24.000Z","size":220,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-04T07:51:20.654Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/numtel.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-10-15T23:47:33.000Z","updated_at":"2016-07-05T04:59:20.000Z","dependencies_parsed_at":"2022-08-18T01:00:55.068Z","dependency_job_id":null,"html_url":"https://github.com/numtel/tinytest-in-app","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/numtel%2Ftinytest-in-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtel%2Ftinytest-in-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtel%2Ftinytest-in-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtel%2Ftinytest-in-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/numtel","download_url":"https://codeload.github.com/numtel/tinytest-in-app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247358660,"owners_count":20926266,"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-11-05T15:29:28.831Z","updated_at":"2025-04-05T15:31:20.946Z","avatar_url":"https://github.com/numtel.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tinytest In App Meteor Package\n\n**This package has been made obsolete by [a technique that requires no extra packages](https://github.com/numtel/meteor-leaderboard-tinytest).**\n\nUse Tinytest to test your Meteor app, just like you would a package.\n\nDoes not use Velocity so the tests do NOT run in a mirror. You must clean up\nany data you create. If you would like to use Velocity with Tinytest in your\napp, see my [numtel:velocity-tinytest package](https://github.com/numtel/velocity-tinytest).\n\n## Installation\nThe `tinytest` package is also required. Install both using this command:\n\n```bash\n$ meteor add tinytest numtel:tinytest-in-app\n```\n\n## Quick start\n\n1. Add a test to your application in any file\n    ```javascript\n    Tinytest.add('test title', function(test){\n      test.equal(true, true);\n    });\n    ```\n\n2. Open the Javascript console in your browser, execute `runTinyTest()`\n\n## Implements\n\n#### runTinytest({...})\n\nRun your tests on the server and in a PhantomJS client then output the results\nto the console. PhantomJS loads the application on the origin of the URL you are\nbrowsing from. For example, if your browser is at `http://localhost:3000/posts/someid`,\nPhantomJS will open `http://localhost:3000` and execute the tests.\n\n**Options:**\n\nKey    | Description\n-------|----------------------------------------------------------------------\n`pathPrefix` | Specify array of strings to narrow the range of tests to execute. For example, if your test was titled `FirstPart - some test`, pass `['tinytest', 'FirstPart']` to only run the tests that begin with `FirstPart - `.\n\n## Tinytest documentation\n\nSince there is no official documentation for Tinytest, it may be helpful to have\nsome here.\n\nTest titles can be any string. Using a separator of `\" - \"` will allow running\na subset of tests using the `pathPrefix` option.\n\n**Test Syntax:**\n```javascript\n// Synchronous test\nTinytest.add('test title', function(test){\n  test.equal(true, true);\n});\n\n// Asynchronous test\nTinytest.addAsync('async test title', function(test, onComplete){\n  Meteor.setTimeout(function(){\n    test.equal(true, true);\n    onComplete();\n  }, 1000);\n});\n```\n\n**Assertions:**\n```javascript\ntest.isFalse(v, msg) // if (!v)\ntest.isTrue(v, msg) // if(v)\ntest.equal(actual, expected, message)\ntest.notEqual(actual, expected, message)\ntest.length(obj, len, msg)\ntest.include(s, v) // s = string or object\ntest.isNaN(v, msg)\ntest.isUndefined(v, msg)\ntest.isNotNull(v, msg)\ntest.isNull(v, msg)\n\n// expected can be:\n//  undefined: accept any exception.\n//  string: pass if the string is a substring of the exception message.\n//  regexp: pass if the exception message passes the regexp.\n//  function: call the function as a predicate with the exception.\ntest.throws(func, expected)\n\ntest.instanceOf(obj, klass)\n\ntest.runId() // Unique id for this test run\n\n// Call this to fail the test with an exception. Use this to record\n// exceptions that occur inside asynchronous callbacks in tests.\n//\n// It should only be used with asynchronous tests, and if you call\n// this function, you should make sure that (1) the test doesn't\n// call its callback (onComplete function); (2) the test function\n// doesn't directly raise an exception.\ntest.exception(exception)\n\ntest.expect_fail()\n```\n\n## Travis CI integration\n\nCreate a `.travis.yml` file in your app repository with the following contents:\n\n```yml\nlanguage: node_js\nnode_js:\n- \"0.10\"\nbefore_install:\n- \"curl -L https://install.meteor.com | /bin/sh\"\n- \"meteor update\"\n- \"wget https://raw.github.com/numtel/tinytest-in-app/master/.startTest.js\"\n- \"wget https://raw.github.com/numtel/tinytest-in-app/master/.phantomRunner.js\"\n# Optionally, arguments can be added to Meteor startup\n# ex: node .startTest.js --port 3500\nscript: \"node .startTest.js\"\n```\n\n## Command line interface\nThe Travis CI integration can be used to run Tinytest from your local command\nline as well.\n\nAdd these two scripts to your application: (Dot files to prevent Meteor from\nincluding them.)\n\n```bash\n$ wget https://raw.github.com/numtel/tinytest-in-app/master/.startTest.js\n$ wget https://raw.github.com/numtel/tinytest-in-app/master/.phantomRunner.js\n```\n\nTo run the tests from your application directory:\n\n```bash\n$ node .startTest.js\n\n# Or specify any parameters to pass through when starting Meteor\n$ node .startTest.js --port 3500\n```\n\n**Notes:**\n* Use `nodejs` command on Debian, Ubuntu systems.\n* Only one instance of Meteor may run at a time in a directory. If your app\n  is running, you should use the in-browser interface instead.\n\n## Related packages\n* [numtel:tinytest-fixture-account](http://github.com/numtel/tinytest-fixture-account) - Create a fixture account for tests, remove when done\n* [numtel:velocity-tinytest](https://github.com/numtel/velocity-tinytest) - Use Tinytest with Velocity in a Meteor app\n\n## Run tests\n\n```bash\n$ git clone https://github.com/numtel/tinytest-in-app.git\n$ cd tinytest-in-app\n$ meteor test-packages ./\n```\n\nOpen your browser to `http://localhost:3000/`\n\nOpen the Javascript console and run the following command:\n\n```javascript\nrunTinytest()\n```\n\nNot all the tests are expected to pass. The tests must be manually verified by\nchecking the browser output against the console output.\n\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumtel%2Ftinytest-in-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnumtel%2Ftinytest-in-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumtel%2Ftinytest-in-app/lists"}