{"id":18304622,"url":"https://github.com/numtel/meteor-leaderboard-tinytest","last_synced_at":"2026-03-15T18:12:19.035Z","repository":{"id":24536000,"uuid":"27942414","full_name":"numtel/meteor-leaderboard-tinytest","owner":"numtel","description":"Use Tinytest to test a Meteor application without any extra packages","archived":false,"fork":false,"pushed_at":"2015-10-29T18:11:50.000Z","size":153,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-21T06:41:24.343Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CSS","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-12-12T23:27:02.000Z","updated_at":"2018-11-14T13:00:13.000Z","dependencies_parsed_at":"2022-08-22T16:40:31.699Z","dependency_job_id":null,"html_url":"https://github.com/numtel/meteor-leaderboard-tinytest","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%2Fmeteor-leaderboard-tinytest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtel%2Fmeteor-leaderboard-tinytest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtel%2Fmeteor-leaderboard-tinytest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtel%2Fmeteor-leaderboard-tinytest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/numtel","download_url":"https://codeload.github.com/numtel/meteor-leaderboard-tinytest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247358677,"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:38.824Z","updated_at":"2026-03-15T18:12:13.979Z","avatar_url":"https://github.com/numtel.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tinytest with app example [![Build Status](https://travis-ci.org/numtel/meteor-leaderboard-tinytest.svg?branch=master)](https://travis-ci.org/numtel/meteor-leaderboard-tinytest)\n\nPreviously, I had created a [tinytest-in-app package](https://github.com/numtel/tinytest-in-app) that would allow Tinytest to be executed from inside your Meteor application with a little PhantomJS magic.\n\nIn this example, I show how to use Tinytest to test an app without any extra packages.\n\nBegin by creating a `package.js` file in your app directory. Describe your application as if it were a package but include this line at the very beginning to skip parsing when not testing:\n\n```javascript\nif(typeof Meteor !== 'undefined') return;\n```\n\nPlace test files in the `tests` directory to exclude them from the Meteor app.\n\nYou may run both the test suite and the application simulaneously from the same directory.\n\n```bash\n$ git clone https://github.com/numtel/meteor-leaderboard-tinytest.git\n$ cd meteor-leaderboard-tinytest\n# Start application\n$ meteor\n# Start test suite\n$ meteor test-packages ./ --port 3500\n```\n\n*Note:* The application's templates will still be rendered inside the test suite results.\n\n## Resources\n\n* [travis-ci-meteor-packages](https://github.com/arunoda/travis-ci-meteor-packages) - Travis CI integration\n* [numtel:benchmark-packages](https://github.com/numtel/meteor-benchmark-packages) - Simple benchmarking\n* [numtel:tinytest-fixture-account](https://github.com/numtel/tinytest-fixture-account) - Write tests that require being logged in\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## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumtel%2Fmeteor-leaderboard-tinytest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnumtel%2Fmeteor-leaderboard-tinytest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumtel%2Fmeteor-leaderboard-tinytest/lists"}