{"id":18867632,"url":"https://github.com/simplrjs/test-generator-cli","last_synced_at":"2026-02-13T15:30:21.175Z","repository":{"id":52164659,"uuid":"116670193","full_name":"SimplrJS/test-generator-cli","owner":"SimplrJS","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-01T22:13:09.000Z","size":71,"stargazers_count":0,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-16T01:11:29.061Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/SimplrJS.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-01-08T11:48:04.000Z","updated_at":"2020-09-17T09:44:18.000Z","dependencies_parsed_at":"2023-01-22T11:20:26.311Z","dependency_job_id":null,"html_url":"https://github.com/SimplrJS/test-generator-cli","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimplrJS%2Ftest-generator-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimplrJS%2Ftest-generator-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimplrJS%2Ftest-generator-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SimplrJS%2Ftest-generator-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SimplrJS","download_url":"https://codeload.github.com/SimplrJS/test-generator-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239816478,"owners_count":19701753,"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-11-08T05:10:28.888Z","updated_at":"2026-02-13T15:30:21.107Z","avatar_url":"https://github.com/SimplrJS.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\r\n  \u003ca href=\"https://github.com/SimplrJS\"\u003e\r\n    \u003cimg width=\"200\" src=\"https://user-images.githubusercontent.com/7989797/27446299-b93aa76c-5785-11e7-8ef6-475f858e3291.png\" /\u003e\r\n  \u003c/a\u003e\r\n\u003c/div\u003e\r\n\u003ch1 align=\"center\"\u003etest-generator-cli\u003c/h1\u003e\r\n\r\nTool to generate tests from cases.\r\n\r\n## Installation\r\n\r\n```sh\r\nnpm install @simplrjs/test-generator-cli -g\r\n```\r\n\r\nGlobal installation is not necessary. You can install this package with:\r\n\r\n```sh\r\nnpm install @simplrjs/test-generator-cli --save-dev\r\n```\r\n\r\nand use it with [`npm-scripts`](https://docs.npmjs.com/misc/scripts).\r\n\r\n## Command line\r\n\r\n### Usage\r\n\r\n```sh\r\ntest-generator-cli -h\r\n```\r\n\r\n### Arguments\r\n\r\n| Argument                      | Type      | Default                   | Description                                                                   |\r\n|-------------------------------|-----------|---------------------------|-------------------------------------------------------------------------------|\r\n| -h, --help                    | boolean   | `false`                   | Show help.                                                                    |\r\n| -v, --version                 | boolean   | `false`                   | Show current version.                                                         |\r\n| -p, --project                 | string    | `./`                      | Project directory path.                                                       |\r\n\r\n### Project tests structure\r\n\r\nLet's say you picked `src` as your project directory.\r\n\r\n```bash\r\n├── src\r\n    └── tests\r\n        ├── cases\r\n        │   ├── __tests__\r\n        │   |   └── __snapshots__\r\n        │   ├── case-1\r\n        │   │   ├── ...\r\n        │   │   ├── test-config.json\r\n        │   │   └── case.test.tpl\r\n        │   └── case-2\r\n        └── default.test.tpl\r\n```\r\n\r\n| File / Directory          | Description                                                                                                                                                     |\r\n|---------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|\r\n| `__tests__`               | Generated tests output directory.                                                                                                                               |\r\n| `__snapshots__`           | Generated tests snapshots directory.                                                                                                                            |\r\n| `case-1`, `case-2`        | Directories for test cases.                                                                                                                                     |\r\n| `case.test.tpl`           | Test template file for certain test case. It's not required. If `case.test.tpl` not found in case directory, test template will fallback to `default.test.tpl`. |\r\n| `test-config.json`        | Config file for a test case. You can reach it template. Config structure is at your discretion.                                                                 |\r\n| `default.test.tpl`        | Default test template file.                                                                                                                                     |\r\n\r\n### Templates\r\n\r\nPackage supports two kinds of templates:\r\n\r\n* `case.test.tpl` - test template file for certain test case. It's not required. If `case.test.tpl` not found in case directory, test template will fallback to `default.test.tpl`.\r\n* `default.test.tpl` - default test template file.\r\n\r\nTemplate should be a valid TypeScript file that can have [Handlebars](http://handlebarsjs.com/) expressions.\r\n\r\n#### Supported expressions\r\n\r\n| Expression              | Description                                           |\r\n|-------------------------|-------------------------------------------------------|\r\n| `{{caseName}}`          | Test case name.                                       |\r\n| `{{projectDirectory}}`  | Project directory path.                               |\r\n| `{{json testConfig}}`   | Test case config file (`test-config.json`) content.   |\r\n\r\n#### Sample\r\n\r\n```typescript\r\nimport * as path from \"path\";\r\nimport { Bundler } from \"@src/bundler\";\r\n\r\ntest(\"{{caseName}}\", async done =\u003e {\r\n    const projectDirectory = \"{{projectDirectory}}\";\r\n    const testConfig = {{{json testConfig}}};\r\n    const entryFile = path.join(projectDirectory, testConfig.Entry);\r\n\r\n    try {\r\n        const bundleResult = await new Bundler()\r\n            .BundleAll([entryFile]);\r\n        expect(bundleResult[0].bundledContent).toMatchSnapshot();\r\n        done();\r\n    } catch (error) {\r\n        done.fail(error);\r\n    }\r\n});\r\n```\r\n\r\n## License\r\n\r\nReleased under the [MIT license](LICENSE).\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplrjs%2Ftest-generator-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimplrjs%2Ftest-generator-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplrjs%2Ftest-generator-cli/lists"}