{"id":15655246,"url":"https://github.com/jaydenseric/test-director","last_synced_at":"2025-05-04T06:48:04.382Z","repository":{"id":56817374,"uuid":"215490846","full_name":"jaydenseric/test-director","owner":"jaydenseric","description":"An ultra lightweight unit test director for Node.js.","archived":false,"fork":false,"pushed_at":"2023-02-27T04:01:50.000Z","size":133,"stargazers_count":26,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T12:54:15.941Z","etag":null,"topics":["esm","maintained","mjs","node","npm","typescript"],"latest_commit_sha":null,"homepage":"https://npm.im/test-director","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/jaydenseric.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":".github/funding.yml","license":"license.md","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},"funding":{"github":"jaydenseric"}},"created_at":"2019-10-16T07:59:00.000Z","updated_at":"2025-01-03T13:47:57.000Z","dependencies_parsed_at":"2024-06-19T06:11:20.367Z","dependency_job_id":"217862a5-7860-4b7d-9e2f-1f910c505a13","html_url":"https://github.com/jaydenseric/test-director","commit_stats":{"total_commits":130,"total_committers":1,"mean_commits":130.0,"dds":0.0,"last_synced_commit":"909c56b3cd402ec22713be76a2fa5f27975eef34"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Ftest-director","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Ftest-director/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Ftest-director/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Ftest-director/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaydenseric","download_url":"https://codeload.github.com/jaydenseric/test-director/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252134219,"owners_count":21699674,"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":["esm","maintained","mjs","node","npm","typescript"],"created_at":"2024-10-03T12:57:22.017Z","updated_at":"2025-05-03T02:35:18.102Z","avatar_url":"https://github.com/jaydenseric.png","language":"JavaScript","readme":"# test-director\n\nAn ultra lightweight unit test director for Node.js.\n\nWorks well with any assertion library that throws errors, such as the [Node.js `assert` API](https://nodejs.org/api/assert.html) and [`snapshot-assertion`](https://npm.im/snapshot-assertion).\n\nUse [`coverage-node`](https://npm.im/coverage-node) to run your test script and report code coverage.\n\n## Installation\n\nTo install [`test-director`](https://npm.im/test-director) with [npm](https://npmjs.com/get-npm), run:\n\n```sh\nnpm install test-director --save-dev\n```\n\nThen, import and use the class [`TestDirector`](./TestDirector.mjs).\n\n## Examples\n\nA sync test:\n\n```js\nimport { equal } from \"node:assert\";\nimport TestDirector from \"test-director\";\n\nconst tests = new TestDirector();\n\ntests.add(\"JavaScript addition.\", () =\u003e {\n  equal(1 + 1, 2);\n});\n\ntests.run();\n```\n\nAn async test:\n\n```js\nimport { ok } from \"node:assert\";\nimport TestDirector from \"test-director\";\n\nconst tests = new TestDirector();\n\ntests.add(\"GitHub is up.\", async () =\u003e {\n  const response = await fetch(\"https://github.com\");\n  ok(response.ok);\n});\n\ntests.run();\n```\n\nNested tests:\n\n```js\nimport TestDirector from \"test-director\";\n\nconst tests = new TestDirector();\n\ntests.add(\"Test A.\", async () =\u003e {\n  const tests = new TestDirector();\n\n  tests.add(\"Test B.\", () =\u003e {\n    // …\n  });\n\n  tests.add(\"Test C.\", () =\u003e {\n    // …\n  });\n\n  await tests.run(true);\n});\n\ntests.add(\"Test D.\", () =\u003e {\n  // …\n});\n\ntests.run();\n```\n\n## Requirements\n\nSupported runtime environments:\n\n- [Node.js](https://nodejs.org) versions `^16.9.0 || \u003e= 18.0.0`.\n\nProjects must configure [TypeScript](https://typescriptlang.org) to use types from the ECMAScript modules that have a `// @ts-check` comment:\n\n- [`compilerOptions.allowJs`](https://typescriptlang.org/tsconfig#allowJs) should be `true`.\n- [`compilerOptions.maxNodeModuleJsDepth`](https://typescriptlang.org/tsconfig#maxNodeModuleJsDepth) should be reasonably large, e.g. `10`.\n- [`compilerOptions.module`](https://typescriptlang.org/tsconfig#module) should be `\"node16\"` or `\"nodenext\"`.\n\n## Exports\n\nThe [npm](https://npmjs.com) package [`test-director`](https://npm.im/test-director) features [optimal JavaScript module design](https://jaydenseric.com/blog/optimal-javascript-module-design). These ECMAScript modules are exported via the [`package.json`](./package.json) field [`exports`](https://nodejs.org/api/packages.html#exports):\n\n- [`TestDirector.mjs`](./TestDirector.mjs)\n","funding_links":["https://github.com/sponsors/jaydenseric"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaydenseric%2Ftest-director","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaydenseric%2Ftest-director","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaydenseric%2Ftest-director/lists"}