{"id":20246895,"url":"https://github.com/pmsipilot/esdoc-test-plugin","last_synced_at":"2025-03-03T15:42:57.182Z","repository":{"id":142893120,"uuid":"87805350","full_name":"pmsipilot/esdoc-test-plugin","owner":"pmsipilot","description":"Documentation test plugin for ESDoc","archived":false,"fork":false,"pushed_at":"2017-04-11T08:36:48.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-14T02:12:45.173Z","etag":null,"topics":["esdoc","jsdoc"],"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/pmsipilot.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-10T11:56:28.000Z","updated_at":"2023-09-08T17:23:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"9ad5ceb9-7dde-4704-be65-606cfc27ce94","html_url":"https://github.com/pmsipilot/esdoc-test-plugin","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmsipilot%2Fesdoc-test-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmsipilot%2Fesdoc-test-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmsipilot%2Fesdoc-test-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmsipilot%2Fesdoc-test-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pmsipilot","download_url":"https://codeload.github.com/pmsipilot/esdoc-test-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241692733,"owners_count":20004292,"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":["esdoc","jsdoc"],"created_at":"2024-11-14T09:34:02.819Z","updated_at":"2025-03-03T15:42:57.160Z","avatar_url":"https://github.com/pmsipilot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ESDoc Documentation Test Plugin\n\nThis plugin will convert any Javascript snippet inside descriptions into executable test.\n\nWriting a good documentation often requires to write good examples. Keeping these examples in sync with the actual code\nis hard when you don't check them. With this plugin, ESDoc will turn any snippet into executable tests and run them each\ntime you build the doc.\n\n## Installation\n\n```\nnpm install --save esdoc esdoc-test-plugin\n```\n\n## Configuration\n\nTo enable the plugin, update tour `.esdoc.json` configuration file:\n\n```json\n{\n    \"source\": \"./src\",\n    \"destination\": \"./public\",\n    \"plugin\": [\n        {\n            \"name\": \"./esdoc-test-plugin\",\n            \"option\": {\n                \"path\": \"./src\"\n            }\n        }\n    ]\n}\n```\n\nHere is the complete list of configuration options:\n\n| Name              | Type      | Default | Annotation | Description                                                                                                     |\n|-------------------|-----------|---------|------------|-----------------------------------------------------------------------------------------------------------------|\n| `path`            | `String`  |         | ✓          | The base path to the source directory. Might be the same as the `source` directive of ESDoc.                    |\n| `exitOnFailure`   | `Boolean` | `false` |            | Should ESDoc exit immediately if a test failed.                                                                 |\n| `exitWithFailure` | `Boolean` | `true`  |            | Should ESDoc exit with an error status if a test failed.                                                        |\n| `assert`          | `String`  | `node`  | ✓          | Which assertion framework to use (one of: `chai`, `chai-expect`, `chai-assert`, `expect`, `expect.js`, `node`). |\n\n## Usage\n\nGiven you have the following Javascript code and its documentation:\n\n~~~js\n/**\n* @param {Number} x\n* @param {Number} y\n* \n* @return {Number}\n*/\nconst add = (x, y) =\u003e x + y;\n~~~\n\nYou can add some test in the description:\n\n~~~js\n/**\n * This function adds two numbers:\n * \n * ```js\n * const add = require('./add');\n * \n * assert.equal(add(1, 2), 3);\n * ```\n * \n * @param {Number} x\n * @param {Number} y\n * \n * @return {Number}\n */\nconst add = (x, y) =\u003e x + y;\n~~~\n\nThis will generate a single test for the `add` function. \n\n_Note that the `require` is relative to the `plugin.option.path` configuration directive (the actual file is located \nat `./src/add.js`)._\n\nYou can add more test by writing more snippets:\n\n~~~js\n/**\n * This function adds two numbers:\n * \n * ```js\n * const add = require('./add');\n * \n * assert.equal(add(1, 2), 3);\n * ```\n *\n * ```js\n * const add = require('./add');\n * \n * assert.equal(add(-1, -2), -3);\n * ```\n * \n * @param {Number} x\n * @param {Number} y\n * \n * @return {Number}\n */\nconst add = (x, y) =\u003e x + y;\n~~~\n\nYou can also use annotation to configure some tests:\n\n~~~js\n/**\n * This function adds two numbers:\n * \n * ```js#assert=chai\n * const add = require('./add');\n * \n * add(1, 2).should.equal(3);\n * ```\n * \n * @param {Number} x\n * @param {Number} y\n * \n * @return {Number}\n */\nconst add = (x, y) =\u003e x + y;\n~~~\n\nAnnotation are written next to the language with the following format: `js[[#name[=value]]...]`. If the annotation has no\nvalue, its default value will be `true`.\n\nThe `path` and `assert` configuration directives can be overridden at the test level using annotations. You can also use\nthe `skip` annotation to mark a test as skipped.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmsipilot%2Fesdoc-test-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpmsipilot%2Fesdoc-test-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmsipilot%2Fesdoc-test-plugin/lists"}