{"id":13772691,"url":"https://github.com/dubzzz/ava-fast-check","last_synced_at":"2025-05-11T05:33:23.877Z","repository":{"id":39068913,"uuid":"147577934","full_name":"dubzzz/ava-fast-check","owner":"dubzzz","description":"Property based testing for AVA based on fast-check","archived":true,"fork":false,"pushed_at":"2022-06-23T23:52:21.000Z","size":265,"stargazers_count":45,"open_issues_count":6,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-17T08:44:00.957Z","etag":null,"topics":["ava","generative-testing","property-based-testing","quickcheck","unit-testing"],"latest_commit_sha":null,"homepage":"","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/dubzzz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"open_collective":"fast-check"}},"created_at":"2018-09-05T20:50:36.000Z","updated_at":"2024-07-04T17:31:42.000Z","dependencies_parsed_at":"2022-09-10T09:02:11.794Z","dependency_job_id":null,"html_url":"https://github.com/dubzzz/ava-fast-check","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dubzzz%2Fava-fast-check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dubzzz%2Fava-fast-check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dubzzz%2Fava-fast-check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dubzzz%2Fava-fast-check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dubzzz","download_url":"https://codeload.github.com/dubzzz/ava-fast-check/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253523690,"owners_count":21921815,"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":["ava","generative-testing","property-based-testing","quickcheck","unit-testing"],"created_at":"2024-08-03T17:01:06.936Z","updated_at":"2025-05-11T05:33:23.556Z","avatar_url":"https://github.com/dubzzz.png","language":"JavaScript","funding_links":["https://opencollective.com/fast-check"],"categories":["Packages","TypeScript","JavaScript"],"sub_categories":[],"readme":"⚠️⚠️⚠️ Project moved to https://github.com/dubzzz/fast-check/tree/main/packages/ava ⚠️⚠️⚠️\n\n---\n\n# Property based testing for AVA based on [fast-check](https://github.com/dubzzz/fast-check/)\n\n[![Build Status](https://github.com/dubzzz/ava-fast-check/workflows/Build%20Status/badge.svg?branch=main)](https://github.com/dubzzz/ava-fast-check/actions)\n[![npm version](https://badge.fury.io/js/ava-fast-check.svg)](https://badge.fury.io/js/ava-fast-check)\n\nBring the power of property based testing framework fast-check into AVA.\n`ava-fast-check` simplifies the integration of fast-check into AVA testing framework.\n\n## Getting Started\n\nInstall `ava-fast-check` and its peer dependencies:\n\n```bash\nnpm install --save-dev ava fast-check ava-fast-check\n```\n\n## Example\n\n```typescript\nimport { testProp, fc } from 'ava-fast-check';\n\n// for all a, b, c strings\n// b is a substring of a + b + c\ntestProp('should detect the substring', [fc.string(), fc.string(), fc.string()], (t, a, b, c) =\u003e {\n  t.true((a + b + c).includes(b));\n});\n```\n\nThe property is passed [AVA's `t` argument](https://github.com/avajs/ava/blob/main/docs/02-execution-context.md#execution-context-t-argument) for its first parameter, and the value of each arbitrary for the current test case for the rest of the parameters.\n\n`ava-fast-check` supports all of [AVA's assertions](https://github.com/avajs/ava/blob/main/docs/03-assertions.md#assertions) and like AVA, supports synchronous and asynchronous functions, including promises, observables, and callbacks. See [AVA's documentation](https://github.com/avajs/ava/blob/main/docs/01-writing-tests.md#declaring-test) for more information.\n\n## Advanced\n\n### `fast-check` Parameters\n\n`testProp` accepts an optional `fc.Parameters` for forwarding custom parameters to `fast-check` ([more](https://github.com/dubzzz/fast-check/blob/main/documentation/Runners.md#runners)).\n\n### AVA Modifiers\n\n`ava-fast-check` also comes with [`.only`], [`.serial`] [`.skip`], and [`.failing`] modifiers from AVA.\n\n```typescript\nimport { testProp, fc } from 'ava-fast-check';\n\ntestProp('should replay the test for the seed 4242', [fc.nat(), fc.nat()], (t, a, b) =\u003e {\n  t.is(a + b, b + a);\n}, { seed: 4242 });\n\ntestProp.skip('should be skipped', [fc.fullUnicodeString()], (t, text) =\u003e {\n  t.is([...text].length, text.length);\n});\n```\n\n[`.only`]: https://github.com/avajs/ava/blob/main/docs/01-writing-tests.md#running-specific-tests\n[`.serial`]: https://github.com/avajs/ava/blob/main/docs/01-writing-tests.md#running-tests-serially\n[`.skip`]: https://github.com/avajs/ava/blob/main/docs/01-writing-tests.md#skipping-tests\n[`.failing`]: https://github.com/avajs/ava/blob/main/docs/01-writing-tests.md#failing-tests\n\n### AVA `before`/`after` Hooks\n\n`ava-fast-check` exposes AVA's `before`/`after` [hooks]:\n\n```typescript\nimport { testProp, fc } from 'ava-fast-check';\n\ntestProp.before(t =\u003e {\n  connectToDatabase();\n});\n\ntestProp(\n  // ... omitted for brevity\n);\n\ntestProp.after(t =\u003e {\n  closeDatabaseConnection();\n});\n```\n\n[hooks]: https://github.com/avajs/ava/blob/main/docs/01-writing-tests.md#before--after-hooks\n\n### AVA Execution Context\n\n`ava-fast-check` mirror's AVA's procedure for customizing the test [execution context]:\n\n```typescript\nimport { fc, testProp as anyTestProp, PropertyTestInterface } from '../src/ava-fast-check';\n\ntype TestContext = {\n  state: string\n};\n\nconst testProp = anyTestProp as PropertyTestInterface\u003cTestContext\u003e;\n\ntestProp(\n  'should reach terminal state',\n  [fc.string()],\n  (t, received) =\u003e {\n    // here t is typed as ExecutionContext\u003cTestContext\u003e\n    console.log(t.context.state); // logs 'uninitialized'\n    // ... omitted for brevity\n  }\n);\n```\n\n[execution context]: https://github.com/avajs/ava/blob/main/docs/02-execution-context.md\n\n## Minimal requirements\n\n| ava-fast-check | AVA                   | fast-check              |\n|----------------|-----------------------|-------------------------|\n| ^6.0.0         | \u003e=4.0.0               | ^3.0.0                  |\n| ^5.0.0         | \u003e=4.0.0               | ^2.0.0\u003csup\u003e(2)(4)\u003c/sup\u003e |\n| ^4.0.0         | \u003e=3.9.0\u003csup\u003e(1)\u003c/sup\u003e | ^2.0.0\u003csup\u003e(2)\u003c/sup\u003e    |\n| ^3.0.0         | \u003e=3.9.0\u003csup\u003e(1)\u003c/sup\u003e | ^2.0.0\u003csup\u003e(2)\u003c/sup\u003e    |\n| ^2.0.0         | \u003e=3.9.0\u003csup\u003e(1)\u003c/sup\u003e | ^1.0.0                  |\n| ^1.0.0         | \u003e=0.1.0\u003csup\u003e(3)\u003c/sup\u003e | ^1.0.0                  |\n\n- (1) `ava@\u003e=3.9.0` for [`t.try`](https://github.com/avajs/ava/blob/main/docs/03-assertions.md#trytitle-implementation--macro--macro-args) support\n- (2) `fast-check@^2.0.0` for hybrid module support: `commonjs` and `esm` together\n- (3) `ava@\u003e=0.1.0` for its Promise support\n- (4) Already compatible with `fast-check@^3.0.0` but bump to `6.0.0` for updated peer version\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdubzzz%2Fava-fast-check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdubzzz%2Fava-fast-check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdubzzz%2Fava-fast-check/lists"}