{"id":13394497,"url":"https://github.com/sazeracjs/sazerac","last_synced_at":"2025-05-16T11:05:53.752Z","repository":{"id":15846046,"uuid":"76695739","full_name":"sazeracjs/sazerac","owner":"sazeracjs","description":"Data-driven unit testing for Jasmine, Mocha, and Jest","archived":false,"fork":false,"pushed_at":"2023-01-05T01:27:35.000Z","size":2289,"stargazers_count":318,"open_issues_count":36,"forks_count":19,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-11T06:37:39.212Z","etag":null,"topics":["assertions","data-driven-tests","jasmine","javascript","jest","mocha","unit-testing"],"latest_commit_sha":null,"homepage":"https://sazerac.js.org/","language":"JavaScript","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/sazeracjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2016-12-17T00:50:41.000Z","updated_at":"2025-01-30T16:18:40.000Z","dependencies_parsed_at":"2023-01-11T20:24:04.922Z","dependency_job_id":null,"html_url":"https://github.com/sazeracjs/sazerac","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sazeracjs%2Fsazerac","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sazeracjs%2Fsazerac/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sazeracjs%2Fsazerac/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sazeracjs%2Fsazerac/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sazeracjs","download_url":"https://codeload.github.com/sazeracjs/sazerac/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254518383,"owners_count":22084374,"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":["assertions","data-driven-tests","jasmine","javascript","jest","mocha","unit-testing"],"created_at":"2024-07-30T17:01:21.694Z","updated_at":"2025-05-16T11:05:48.734Z","avatar_url":"https://github.com/sazeracjs.png","language":"JavaScript","readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://sazerac.js.org\" target=\"_blank\"\u003e\u003cimg width=\"50\" src=\"http://sazerac.js.org/images/logo.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://circleci.com/gh/sazeracjs/sazerac/tree/master\"\u003e\u003cimg src=\"https://circleci.com/gh/sazeracjs/sazerac/tree/master.svg?style=svg\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nSazerac\n=======\n\nData-driven unit testing for JavaScript.\n\nAbout\n-----\n\nSazerac is a library for [data-driven testing][] in JavaScript. It works with\n[mocha][], [jasmine][], and [jest][]. Using Sazerac, and the data-driven\ntesting pattern in general, will reduce the complexity and increase\nreadability of your test code.\n\nCheck out [sazerac.js.org][] for docs and [sazerac-example][] for examples.\n\n[data-driven testing]: https://hackernoon.com/sazerac-data-driven-testing-for-javascript-e3408ac29d8c#.xppc8jjvo\n[mocha]: https://mochajs.org/\n[jasmine]: https://jasmine.github.io/\n[jest]: https://jestjs.io/\n[sazerac.js.org]: https://sazerac.js.org/\n[sazerac-example]: https://github.com/sazeracjs/sazerac-example\n\n\nWhy Use It?\n-----------\n\nLet's say you have a function `isPrime()`. When given a number, it returns `true` or `false` depending on whether the number is a prime number.\n\n```js\nfunction isPrime(num) {\n  for(var i = 2; i \u003c num; i++) {\n    if(num % i === 0) return false;\n  }\n  return num \u003e 1;\n}\n```\n\nIf you're using a framework like [jasmine][], your tests might look something like this:\n\n```js\ndescribe('isPrime()', () =\u003e {\n\n  describe('when given 2', () =\u003e {\n    it('should return true', () =\u003e {\n      assert.isTrue(isPrime(2))\n    })\n  })\n\n  describe('when given 3', () =\u003e {\n    it('should return true', () =\u003e {\n      assert.isTrue(isPrime(3))\n    })\n  })\n\n  describe('when given 4', () =\u003e {\n    it('should return false', () =\u003e {\n      assert.isFalse(isPrime(4))\n    })\n  })\n\n  // and more ...\n\n})\n```\n\nIt's a lot of code to write for only 3 test cases and such a basic function!\n\nThe same tests can be defined with Sazerac as follows:\n\n```js\ntest(isPrime, () =\u003e {\n  given(2).expect(true)\n  given(3).expect(true)\n  given(4).expect(false)\n})\n```\n\nSazerac runs the `describe` and `it` functions needed for these test cases. It adds reporting messages in a consistent format based on the input and output parameters. For this example, the test report ends up looking like this:\n\n```\nisPrime()\n  when given 2\n    ✓ should return true\n  when given 3\n    ✓ should return true\n  when given 4\n    ✓ should return false\n```\n\n\nInstallation\n------------\n\nInstall Sazerac as an npm module and save it to your `package.json` file as a development dependency:\n\n```js\nnpm install sazerac --save-dev\n```\n\nImport the `test` and `given` helper functions into your project:\n\n```js\nimport { test, given } from 'sazerac'\n```\n\nGuide and API documentation\n---------------------------\n\nVisit [sazerac.js.org][].\n\nContributing\n------------\n\nYes, please do :)\n\nGet In Touch\n------------\n\n- [@MikeCalvanese](https://twitter.com/MikeCalvanese)\n- [@paulmelnikow](https://twitter.com/paulmelnikow)\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsazeracjs%2Fsazerac","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsazeracjs%2Fsazerac","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsazeracjs%2Fsazerac/lists"}