{"id":19026629,"url":"https://github.com/wrumsby/ristretto","last_synced_at":"2025-04-23T12:51:26.031Z","repository":{"id":8603546,"uuid":"10241588","full_name":"wrumsby/ristretto","owner":"wrumsby","description":"A browser friendly assertion library for Mocha","archived":false,"fork":false,"pushed_at":"2016-12-22T20:00:33.000Z","size":26,"stargazers_count":10,"open_issues_count":7,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-18T00:11:14.383Z","etag":null,"topics":["javascript","legacy","mocha","unit-testing"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wrumsby.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-05-23T10:43:15.000Z","updated_at":"2016-12-22T20:00:35.000Z","dependencies_parsed_at":"2022-09-13T17:42:53.733Z","dependency_job_id":null,"html_url":"https://github.com/wrumsby/ristretto","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wrumsby%2Fristretto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wrumsby%2Fristretto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wrumsby%2Fristretto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wrumsby%2Fristretto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wrumsby","download_url":"https://codeload.github.com/wrumsby/ristretto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250438077,"owners_count":21430809,"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":["javascript","legacy","mocha","unit-testing"],"created_at":"2024-11-08T20:49:53.197Z","updated_at":"2025-04-23T12:51:26.006Z","avatar_url":"https://github.com/wrumsby.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\n\nRistretto is a browser friendly assertion library for [Mocha](http://mochajs.org/).\n\nThe library exists mainly because Chai's `assert` API [doesn't work in older versions of Internet Explorer](https://github.com/chaijs/chai/issues/117). If you want to use an `assert`-style assertion API with Mocha and you want to run your tests in IE 8 or older then Ristretto is for you.\n\n# Using Ristretto\n\nRistretto is intended to be used as an AMD module in conjuction with an AMD loader like [RequireJS](http://www.requirejs.org/) or [curl](https://github.com/cujojs/curl), e.g.\n\n    require(['ristretto', 'something'], function (assert, something) {\n    \tdescribe('something', function () {\n    \t\tdescribe('method', function () {\n\t    \t\tit('should work', function () {\n\t    \t\t\tvar actual = something.method();\n\n\t    \t\t\tassert.isTrue(actual);\n\t    \t\t});\n    \t\t});\n    \t});\n    });\n\nWhilst using modules is highly recommended, it is possible to use Ristretto without using AMD modules. If AMD support is not detected `ristretto` is attached to the `window` object, e.g.\n\n\t(function () {\n\t    var assert = window.ristretto;\n\n    \tdescribe('something', function () {\n    \t\tdescribe('method', function () {\n\t    \t\tit('should work', function () {\n\t    \t\t\tvar actual = something.method();\n\n\t    \t\t\tassert.isTrue(actual);\n\t    \t\t});\n    \t\t});\n    \t});\n\t} ());\n\n# Package Manager Support\n\nRistretto is available as a [JamJS](http://jamjs.org/) [package](http://jamjs.org/packages/#/details/ristretto). To install Ristretto via Jam first install Jam:\n\n    npm install -g jamjs\n\nThen install Ristretto in your project directory:\n\n    jam install ristretto\n\nRistretto is also available as a [Bower](http://bower.io/) package. To install Ristretto via Bower first install Bower:\n\n\tnpm install -g bower\n\nThen install Ristretto in your project directory:\n\n\tbower install ristretto\n\n# API\n\n## Testing Truthiness\n\n    require(['ristretto'], function (assert) {\n    \tdescribe('something', function () {\n    \t\tit('should be truthy', function () {\n    \t\t\tvar actual = 1;\n\n    \t\t\tassert.isTruthy(actual);\n    \t\t\t// you could also express this as\n    \t\t\tassert.truthy(actual);\n    \t\t\t// or\n    \t\t\tassert(actual);\n    \t\t});\n\n    \t\tit('should be falsey', function () {\n    \t\t\tvar actual = 0;\n\n    \t\t\tassert.isFalsey(actual);\n    \t\t\t// you could also express this as\n    \t\t\tassert.falsey(actual);\n    \t\t\t// or\n    \t\t\tassert(!actual);\n    \t\t});\n    \t});\n    });\n\n# Equality\n\n    require(['ristretto', 'something'], function (assert, something) {\n    \tdescribe('something', function () {\n    \t\tdescribe('method', function () {\n\t    \t\tit('should equal 1', function () {\n\t    \t\t\tvar expected = 1,\n\t    \t\t\t\tactual = something.method();\n\n\t    \t\t\tassert.strictEqual(actual, expected);\n\t    \t\t\t// you could also express this as\n\t    \t\t\tassert(actual === expected);\n\t    \t\t\t// or, although things can be equal that aren't strictEqual\n\t    \t\t\tassert.equal(actual, expected);\n\t    \t\t});\n\n\t    \t\tit('should not equal 2', function () {\n\t    \t\t\tvar expected = 2,\n\t    \t\t\t\tactual = something.method();\n\n\t    \t\t\tassert.strictNotEqual(actual, expected);\n\t    \t\t\t// you could also express this as\n\t    \t\t\tassert(actual !== expected);\n\t    \t\t\t// or, although things can be strictNotEqual that aren't notEqual\n\t    \t\t\tassert.notEqual(actual, expected);\n\t    \t\t});\n    \t\t});\n    \t});\n    });\n\n# Deep Equality\n\n\trequre(['ristretto'], function (assert) {\n\t\tdescribe('something', function () {\n\t\t\tvar actual = [1, 2, 3],\n\t\t\t\texpected = [1, 2, 3];\n\n\t\t\tassert.deepEqual(actual, expected);\n\t\t});\n\t});\n\n# Failure\n\n    require(['ristretto', 'testable'], function (assert, Testable) {\n    \tdescribe('testable', function () {\n    \t\tdescribe('method', function () {\n\t    \t\tit('should not fire an \"invoked\" event', function () {\n\t\t\t\t\tvar testable = new Testable();\n\n\t\t\t\t\ttestable.on('invoked', function () {\n\t\t\t\t\t\tassert.fail('\"invoked\" event should not be fired');\n\t\t\t\t\t});\n\n\t\t\t\t\ttestable.method();\n\t\t\t\t});\n    \t\t});\n    \t});\n    });\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwrumsby%2Fristretto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwrumsby%2Fristretto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwrumsby%2Fristretto/lists"}