{"id":15364738,"url":"https://github.com/xudafeng/command-line-test","last_synced_at":"2025-07-09T03:10:22.755Z","repository":{"id":57144783,"uuid":"21038369","full_name":"xudafeng/command-line-test","owner":"xudafeng","description":"command-line test tool for Node.js","archived":false,"fork":false,"pushed_at":"2021-07-17T05:08:57.000Z","size":11,"stargazers_count":14,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T09:42:17.614Z","etag":null,"topics":["macaca"],"latest_commit_sha":null,"homepage":"","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/xudafeng.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","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":"2014-06-20T13:13:40.000Z","updated_at":"2021-07-17T05:08:59.000Z","dependencies_parsed_at":"2022-09-17T19:01:52.090Z","dependency_job_id":null,"html_url":"https://github.com/xudafeng/command-line-test","commit_stats":null,"previous_names":["macacajs/command-line-test","xudafeng/yacc"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/xudafeng/command-line-test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xudafeng%2Fcommand-line-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xudafeng%2Fcommand-line-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xudafeng%2Fcommand-line-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xudafeng%2Fcommand-line-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xudafeng","download_url":"https://codeload.github.com/xudafeng/command-line-test/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xudafeng%2Fcommand-line-test/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263881049,"owners_count":23524429,"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":["macaca"],"created_at":"2024-10-01T13:13:11.809Z","updated_at":"2025-07-09T03:10:22.736Z","avatar_url":"https://github.com/xudafeng.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# command-line-test\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][coveralls-image]][coveralls-url]\n[![node version][node-image]][node-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/command-line-test.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/command-line-test\n[travis-image]: https://img.shields.io/travis/xudafeng/command-line-test.svg?style=flat-square\n[travis-url]: https://travis-ci.org/xudafeng/command-line-test\n[coveralls-image]: https://img.shields.io/coveralls/xudafeng/command-line-test.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/xudafeng/command-line-test?branch=master\n[node-image]: https://img.shields.io/badge/node.js-%3E=_4-green.svg?style=flat-square\n[node-url]: http://nodejs.org/download/\n[download-image]: https://img.shields.io/npm/dm/command-line-test.svg?style=flat-square\n[download-url]: https://npmjs.org/package/command-line-test\n\n\u003e command-line test tool for Node.js\n\n## Installment\n\n```bash\n$ npm i command-line-test --save-dev\n```\n\n## Usage\n\n`fork`, `spawn`, `exec`, `execFile` supported.\n\n```javascript\nconst CliTest = require('command-line-test');\n\ndescribe('test', function() {\n  it('constructor should be ok', function() {\n    CliTest.should.be.ok();\n  });\n\n  it('exec method should be ok with yeild', function *() {\n    const cliTest = new CliTest();\n    const res = yield cliTest.exec('cat package.json');\n    /**\n    * res return\n    * {\n    *   error,\n    *   stdout,\n    *   stderr\n    * }\n    */\n    const _pkg = JSON.parse(res.stdout);\n    pkg.name.should.be.equal(_pkg.name);\n  });\n\n  it('exec method should be ok with promise', function(done) {\n    const cliTest1 = new CliTest();\n    cliTest1.exec('cat package.json').then(res =\u003e {\n      const _pkg = JSON.parse(res.stdout);\n      pkg.name.should.be.equal(_pkg.name);\n      done();\n    });\n  });\n\n  it('exec method should be ok with callback', function(done) {\n    const cliTest1 = new CliTest();\n    cliTest1.exec('cat package.json', function(err, res) {\n      const _pkg = JSON.parse(res.stdout);\n      pkg.name.should.be.equal(_pkg.name);\n      done();\n    });\n  });\n});\n```\n\n## Sample\n\n- [xudafeng/macaca-cli](//github.com/xudafeng/macaca-cli/)\n- [xudafeng/app-inspector](//github.com/xudafeng/app-inspector/)\n- [xudafeng/detect-port](//github.com/node-modules/detect-port/)\n- [reliablejs/reliable-master](//github.com/reliablejs/reliable-master/)\n- [reliablejs/reliable-macaca-slave](//github.com/reliablejs/reliable-macaca-slave)\n\n## License\n\nThe MIT License (MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxudafeng%2Fcommand-line-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxudafeng%2Fcommand-line-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxudafeng%2Fcommand-line-test/lists"}