{"id":16111792,"url":"https://github.com/cliffano/cmdt","last_synced_at":"2025-09-22T05:32:53.891Z","repository":{"id":56669687,"uuid":"13416986","full_name":"cliffano/cmdt","owner":"cliffano","description":"Command-line tool for testing command-line tools","archived":false,"fork":false,"pushed_at":"2022-10-11T09:30:48.000Z","size":658,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-12T06:02:57.366Z","etag":null,"topics":["cli","nodejs","testing"],"latest_commit_sha":null,"homepage":"","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/cliffano.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2013-10-08T15:12:28.000Z","updated_at":"2024-08-25T00:25:33.000Z","dependencies_parsed_at":"2022-08-15T23:00:40.458Z","dependency_job_id":null,"html_url":"https://github.com/cliffano/cmdt","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cliffano%2Fcmdt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cliffano%2Fcmdt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cliffano%2Fcmdt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cliffano%2Fcmdt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cliffano","download_url":"https://codeload.github.com/cliffano/cmdt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233828145,"owners_count":18736578,"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":["cli","nodejs","testing"],"created_at":"2024-10-09T19:45:32.731Z","updated_at":"2025-09-22T05:32:48.618Z","avatar_url":"https://github.com/cliffano.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg align=\"right\" src=\"https://raw.github.com/cliffano/cmdt/master/avatar.jpg\" alt=\"Avatar\"/\u003e\n\n[![Build Status](https://img.shields.io/travis/cliffano/cmdt.svg)](http://travis-ci.org/cliffano/cmdt)\n[![Dependencies Status](https://img.shields.io/david/cliffano/cmdt.svg)](http://david-dm.org/cliffano/cmdt)\n[![Coverage Status](https://img.shields.io/coveralls/cliffano/cmdt.svg)](https://coveralls.io/r/cliffano/cmdt?branch=master)\n[![Published Version](https://img.shields.io/npm/v/cmdt.svg)](http://www.npmjs.com/package/cmdt)\n\u003cbr/\u003e\n[![npm Badge](https://nodei.co/npm/cmdt.png)](http://npmjs.org/package/cmdt)\n\nCmdt\n----\n\nCmdt is a command-line tool for testing command-line tools.\n\nThis is handy for testing a command line execution result by checking its exit code and output. Commands will be executed in a temporary directory /tmp/cmdt-\u003cmillis\u003e-\u003cpid\u003e/\u003cfilepath\u003e , this directory will be removed after all tests are completed unless -d/--debug flag is specified.\n\nInstallation\n------------\n\n    npm install -g cmdt\n\nUsage\n-----\n\nRun tests on specified test files:\n\n    cmdt run \u003cfile1\u003e.yml \u003cfile2\u003e.yml\n\nRun all test files contained in a directory:\n\n    cmdt run \u003cdir\u003e\n\nDebug exit code and output of failing tests, temporary directory will be logged and won't be removed at the end of the execution:\n\n    cmdt run --debug \u003cfile\u003e.yml \u003cdir\u003e\n\nTest File\n---------\n\nSet test command, expected exit code and/or output regular expression in a .yml file:\n\n    - description: should display user name\n      command: whoami\n      exitcode: 0\n      output: someuser\n\n    - command: time\n      exitcode: 0\n      output: real.+(\\r\\n?|\\n)user.+\n      stdout: real.+(\\r\\n?|\\n)user.+\n\n    - command: unknowncommand\n      exitcode: 1\n      stderr: ^some error$\n\nParameters can also be specified, and used in test command:\n\n    - params:\n        first_name: 'Theodore'\n        last_name: 'Twombly'\n        url: 'http://localhost'\n\n    - command: 'echo \"Hey {first_name} {last_name}!\"'\n      exitcode: 0\n      output: 'echo \"Hey Theodore Twombly!\"'\n\n    - command: 'wget {url}'\n      exitcode: 0\n\nEnvironment variables are available as _env parameter in test commands:\n\n    NAME=\"Theodore Twombly\" cmdt run \u003cfile\u003e.yml \u003cdir\u003e\n\n    - command: 'echo \"Hello {_env.NAME}!\"'\n      exitcode: 0\n      output: 'echo \"Hello Theodore Twombly!\"'\n\nTest fixtures files and directories can be specified in fixtures array, which will then be copied to test execution directory:\n\n    # assuming path/to/data_dir/foobar.txt and path/to/another_dir/barfoo.txt exist\n    - fixtures:\n      - path/to/data_dir\n      - path/to/another_dir/barfoo.txt\n\n    - command: 'file foobar.txt'\n      exitcode: 0\n\n    - command: 'file barfoo.txt'\n      exitcode: 0\n\nTest Fields\n-----------\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth\u003eName\u003c/th\u003e\n    \u003cth\u003eDescription\u003c/th\u003e\n    \u003cth\u003eMandatory\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003edescription\u003c/td\u003e\n    \u003ctd\u003edescription of the test\u003c/td\u003e\n    \u003ctd\u003eNo\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003ecommand\u003c/td\u003e\n    \u003ctd\u003ecommand line to be executed\u003c/td\u003e\n    \u003ctd\u003eYes\u003c/td\u003e    \n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eexitcode\u003c/td\u003e\n    \u003ctd\u003eexpected exit code\u003c/td\u003e\n    \u003ctd\u003eNo\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eoutput\u003c/td\u003e\n    \u003ctd\u003estdout + stderr output, regexp matching\u003c/td\u003e\n    \u003ctd\u003eNo\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003estdout\u003c/td\u003e\n    \u003ctd\u003estdout only output, regexp matching\u003c/td\u003e\n    \u003ctd\u003eNo\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003estderr\u003c/td\u003e\n    \u003ctd\u003estderr only output, regexp matching\u003c/td\u003e\n    \u003ctd\u003eNo\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\nScreenshots\n-----------\n\n![Success with directory arg screenshot](../master/screenshots/success-dir.jpg?raw=true)\n![Failure with file arg on debug mode screenshot](../master/screenshots/failure-file-debug.jpg?raw=true)\n\nColophon\n--------\n\n[Developer's Guide](https://cliffano.github.io/developers_guide.html#nodejs)\n\nBuild reports:\n\n* [Code complexity report](https://cliffano.github.io/cmdt/complexity/plato/index.html)\n* [Unit tests report](https://cliffano.github.io/cmdt/test/buster.out)\n* [Test coverage report](https://cliffano.github.io/cmdt/coverage/buster-istanbul/lcov-report/lib/index.html)\n* [Integration tests report](https://cliffano.github.io/cmdt/test-integration/cmdt.out)\n* [API Documentation](https://cliffano.github.io/cmdt/doc/dox-foundation/index.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcliffano%2Fcmdt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcliffano%2Fcmdt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcliffano%2Fcmdt/lists"}