{"id":16760382,"url":"https://github.com/ryanve/aok","last_synced_at":"2025-06-14T14:36:35.358Z","repository":{"id":6858035,"uuid":"8106856","full_name":"ryanve/aok","owner":"ryanve","description":"Simple JavaScript test suite API","archived":false,"fork":false,"pushed_at":"2014-09-20T12:14:19.000Z","size":655,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T18:56:25.032Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npmjs.org/package/aok","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/ryanve.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-02-09T06:18:32.000Z","updated_at":"2023-08-08T21:08:05.000Z","dependencies_parsed_at":"2022-09-14T03:40:19.628Z","dependency_job_id":null,"html_url":"https://github.com/ryanve/aok","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Faok","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Faok/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Faok/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Faok/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanve","download_url":"https://codeload.github.com/ryanve/aok/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248262052,"owners_count":21074238,"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-10-13T04:23:20.253Z","updated_at":"2025-04-10T17:38:09.292Z","avatar_url":"https://github.com/ryanve.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [aok](../../)\r\n\r\n#### Extensible JavaScript test suite [module](https://npmjs.org/package/aok)\r\n\r\n- [\u003cb\u003eAPI\u003c/b\u003e](#api)\r\n- [\u003cb\u003egrunt aok\u003c/b\u003e](#grunt-aok)\r\n- [\u003cb\u003eResources\u003c/b\u003e](#resources)\r\n- [\u003cb\u003eDevelopers\u003c/b\u003e](#developers)\r\n- [\u003cb\u003eFund\u003c/b\u003e](#fund)\r\n- [\u003cb\u003eLicense\u003c/b\u003e](#license)\r\n\r\n\u003ca name=\"api\"\u003e\u003c/a\u003e\r\n## API ([1.9](../../releases))\r\n\r\n- [\u003cb\u003eaok(\u003c/b\u003e\u003cb\u003e)\u003c/b\u003e](#aok-function)\r\n- [\u003cb\u003eConsole methods\u003c/b\u003e](#console-methods)\r\n- [\u003cb\u003eUtilities\u003c/b\u003e](#utilities)\r\n\r\n\u003ca name=\"aok-function\"\u003e\u003c/a\u003e\r\n### aok() \u0026rarr; `aok` instance\r\n#### Syntaxes\r\n\r\n- [`aok(object)`](#verbose-syntax)\r\n- [`aok(test)`](#anonymous-syntax)\r\n- [`aok(id, test)`](#pair-syntax)\r\n- [`aok()`](#idle-syntax)\r\n\r\n#### Properties\r\n- **id**: identifier or name for the test (defaults to a positive integer)\r\n- **test**: result or callback (called in the instance's scope)\r\n- **pass**: message or callback (default: \"ok\")\r\n- **fail**: message or callback (default: \"FAIL\")\r\n- **handler**: defaults to `aok.prototype.handler`\r\n- **express**: defaults to `aok.prototype.express`\r\n- **explain**: defaults to `aok.prototype.explain`\r\n- **run**: defaults to `aok.prototype.run`\r\n- **cull**: defaults to `aok.prototype.cull`\r\n- **init**: defaults to `aok.prototype.init`\r\n\r\n#### Verbose syntax\r\n##### `aok(object)`\r\n\r\n```js\r\naok({\r\n  id: 'example',\r\n  test: function() {\r\n    return 'example' === this.id;\r\n  }\r\n});\r\n```\r\n\r\n#### Anonymous syntax\r\n##### `aok(test)` for non-object tests\r\n\r\n```js\r\naok(true);\r\naok(aok instanceof aok);\r\naok(function() {\r\n  return isFinite(this.id);\r\n});\r\n```\r\n\r\n#### Pair syntax\r\n##### `aok(id, test)` [1.8+](../../issues/1)\r\n\r\n```js\r\naok('example', true);\r\naok('example', function() {\r\n  return true;\r\n});\r\n```\r\n\r\n#### Idle syntax\r\n##### Calling `aok()` without arguments creates an idle instance that can manually be run later.\r\n\r\n```js\r\nvar o = aok();\r\no.test = true;\r\no.run();\r\n```\r\n\r\n### Console methods\r\n#### uses [native `console`](https://developers.google.com/chrome-developer-tools/docs/console-api) where available\r\n\r\n- `aok.log(message)`\r\n- `aok.info(message)`\r\n- `aok.warn(message)`\r\n- `aok.error(message)`\r\n- `aok.assert(expression, message)` \u003cb\u003e1.6+\u003c/b\u003e\r\n- `aok.trace()`\r\n- `aok.clear()` \u003cb\u003e1.7+\u003c/b\u003e\r\n\r\n### Utilities\r\n\r\n#### aok.can(fn)\r\n- Get a new function that uses `try`/`catch` to test if \u003cvar\u003efn\u003c/var\u003e can run.\r\n- \u0026rArr; Function (\u0026rArr; boolean)\r\n\r\n#### aok.pass(stack, fn, scope?, limit?)\r\n- Iterate \u003cb\u003estack\u003c/b\u003e to count \u003cb\u003epasses\u003c/b\u003e until \u003cb\u003elimit\u003c/b\u003e. ([example](../../commit/5e9273f34bc113bd540534a137fce1302bdb4db4#commitcomment-4498304))\r\n- \u0026rArr; number\r\n\r\n#### aok.fail(stack, fn, scope?, limit?) \r\n- Iterate \u003cvar\u003estack\u003c/var\u003e to count \u003cb\u003efails\u003c/b\u003e until \u003cvar\u003elimit\u003c/var\u003e. ([example](../../commit/5e9273f34bc113bd540534a137fce1302bdb4db4#commitcomment-4498304))\r\n- \u0026rArr; number\r\n\r\n#### aok.perform(trials, fn)\r\n- Test how many milliseconds it takes \u003cvar\u003efn\u003c/var\u003e to run \u003cvar\u003etrials\u003c/var\u003e times.\r\n- \u0026rArr; number\r\n\r\n#### aok.race(trials, rivals)\r\n- Test how many milliseconds it takes each rival to run \u003cvar\u003etrials\u003c/var\u003e times.\r\n- \u0026rArr; Array\r\n\r\n#### aok.result(object, key|fn)\r\n- Get `object[key]` or its method's result if callable.\r\n- \u0026rArr; *\r\n\r\n#### aok.explain(item?)\r\n- Represent \u003cvar\u003eitem\u003c/var\u003e (or self) as a string.\r\n- \u0026rArr; string\r\n\r\n***\r\n\r\n## grunt aok\r\n#### aok 1.5+ includes a simple grunt [task](./tasks) for running tests via [grunt](http://gruntjs.com/)\r\n##### Configure files to [require](http://nodejs.org/api/globals.html#globals_require)\r\n\r\n```js\r\ngrunt.initConfig({\r\n  aok: {\r\n    test: ['./test/'],\r\n    extras: ['./test/extras'] \r\n  }\r\n});\r\n```\r\n\r\n##### Load task `'aok'`\r\n```js\r\ngrunt.loadNpmTasks('aok');\r\n```\r\n\r\n##### Run `'aok'` tasks\r\n\r\n```sh\r\n$ grunt aok\r\n$ grunt aok:test\r\n$ grunt aok:extras\r\n```\r\n## Resources\r\n- See a [\u003cb\u003euniversal\u003c/b\u003e GruntFile](https://github.com/ryanve/universal/blob/master/GruntFile.js) and [test dir](https://github.com/ryanve/universal/tree/master/test) for a solid setup\r\n- See test dirs in [\u003cb\u003eryanve\u003c/b\u003e packages](https://npmjs.org/~ryanve) for examples\r\n\r\n## Developers\r\n#### \u003cb\u003eContribute\u003c/b\u003e edits to [`/src`](./src) or report [issues](../../issues)\r\n\r\n```sh\r\n$ npm install       # install dependencies\r\n$ grunt jshint:sub  # lint sub dirs\r\n$ grunt aok         # run tests\r\n```\r\n\r\nBuilds have \u003cb\u003e+\u003c/b\u003etimestamp in the [version](http://semver.org/) number and are made later via `grunt`.\r\n\r\n## Fund\r\n\r\n\u003cb\u003e[Tip the developer](https://www.gittip.com/ryanve/)\u003c/b\u003e =)\r\n\r\n## License\r\n\r\n[MIT](package.json)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanve%2Faok","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanve%2Faok","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanve%2Faok/lists"}