{"action":"created","comment":{"url":"https://api.github.com/repos/swagger-api/swagger-node/pulls/comments/33384133","id":33384133,"diff_hunk":"@@ -363,3 +371,60 @@ function spawn(command, options, cwd, cb) {\n     cb(err);\n   });\n }\n+\n+\n+//.option('-p, --path-name [path]', 'a sepecific path of the api')\n+//.option('-f, --test-module <module>', 'one of: ' + testmodules)\n+//.option('-t, --assertion-format <type>', 'one of: ' + assertiontypes)\n+function testGenerate(directory, options, cb) {\n+  var template = require('swagger-test-templates');\n+  var pathList = [];\n+  var desiredPaths = [];\n+  var swaggerSpec = require('../../util/spec');\n+\n+  //read the yaml file and validate it\n+  readProject(directory, options, function(err, project) {\n+    if (err) { return cb(err); }\n+    swaggerSpec.validateSwagger(project.api.swagger, options, cb);\n+\n+    // get the array of string paths from json object\n+    pathList = Object.keys(project.api.swagger.paths);\n+\n+    //check if the test frame is one of the two\n+    if (options.testModule && !TESTMODULES[options.testModule]) {\n+      return cb(new Error(util.format('Unknown type: %j. Valid types: %s', options.testModule, TESTMODULES.join(', '))));\n+    }\n+\n+    // check if the assertion-format is one of the three\n+    if (options.assertionFormat && !ASSERTIONTYPES[options.assertionFormat]) {\n+      return cb(new Error(util.format('Unknown type: %j. Valid types: %s', options.assertionFormat, ASSERTIONTYPES.join(', '))));\n+    }\n+\n+    // process the paths option\n+    var regStr = '/' + options.pathName + '/';\n+    var reg = new RegExp(regStr);\n+    if (options.pathName){\n+      desiredPaths = pathList.filter(function(val) {\n+        return val.match(reg);\n+      });\n+    }\n+\n+    // get the result\n+    var config = {\n+      pathName: desiredPaths,\n+      testModule: options.testModule,\n+      assertionFormat: options.assertionFormat\n+    };\n+    var result = template.testGen(project.api.swagger, config);\n+\n+    //output the result\n+    var async = require('async');\n+    async.series(result, function(item, cb) {\n+      var path = item.name;\n+      var filename = path.substirng(1) + '.js';\n+      fs.writeFile('/test/' + filename, item.test, function (err) {","path":"lib/commands/project/project.js","position":79,"original_position":79,"commit_id":"118c35a292796b2e8a42834eb3556bcd3afb44b7","original_commit_id":"118c35a292796b2e8a42834eb3556bcd3afb44b7","user":{"login":"mohsen1","id":543633,"avatar_url":"https://avatars.githubusercontent.com/u/543633?v=3","gravatar_id":"","url":"https://api.github.com/users/mohsen1","html_url":"https://github.com/mohsen1","followers_url":"https://api.github.com/users/mohsen1/followers","following_url":"https://api.github.com/users/mohsen1/following{/other_user}","gists_url":"https://api.github.com/users/mohsen1/gists{/gist_id}","starred_url":"https://api.github.com/users/mohsen1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mohsen1/subscriptions","organizations_url":"https://api.github.com/users/mohsen1/orgs","repos_url":"https://api.github.com/users/mohsen1/repos","events_url":"https://api.github.com/users/mohsen1/events{/privacy}","received_events_url":"https://api.github.com/users/mohsen1/received_events","type":"User","site_admin":false},"body":"`'/test/'` is an absolute path","created_at":"2015-06-26T18:47:15Z","updated_at":"2015-06-26T18:47:15Z","html_url":"https://github.com/swagger-api/swagger-node/pull/237#discussion_r33384133","pull_request_url":"https://api.github.com/repos/swagger-api/swagger-node/pulls/237","_links":{"self":{"href":"https://api.github.com/repos/swagger-api/swagger-node/pulls/comments/33384133"},"html":{"href":"https://github.com/swagger-api/swagger-node/pull/237#discussion_r33384133"},"pull_request":{"href":"https://api.github.com/repos/swagger-api/swagger-node/pulls/237"}}},"pull_request":{"url":"https://api.github.com/repos/swagger-api/swagger-node/pulls/237","id":38677689,"html_url":"https://github.com/swagger-api/swagger-node/pull/237","diff_url":"https://github.com/swagger-api/swagger-node/pull/237.diff","patch_url":"https://github.com/swagger-api/swagger-node/pull/237.patch","issue_url":"https://api.github.com/repos/swagger-api/swagger-node/issues/237","number":237,"state":"open","locked":false,"title":"Cli testing","user":{"login":"elsapeng","id":8696128,"avatar_url":"https://avatars.githubusercontent.com/u/8696128?v=3","gravatar_id":"","url":"https://api.github.com/users/elsapeng","html_url":"https://github.com/elsapeng","followers_url":"https://api.github.com/users/elsapeng/followers","following_url":"https://api.github.com/users/elsapeng/following{/other_user}","gists_url":"https://api.github.com/users/elsapeng/gists{/gist_id}","starred_url":"https://api.github.com/users/elsapeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elsapeng/subscriptions","organizations_url":"https://api.github.com/users/elsapeng/orgs","repos_url":"https://api.github.com/users/elsapeng/repos","events_url":"https://api.github.com/users/elsapeng/events{/privacy}","received_events_url":"https://api.github.com/users/elsapeng/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-26T18:43:03Z","updated_at":"2015-06-26T18:47:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"89957ccd4c82383eed773f9e556b01c523a220db","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/swagger-api/swagger-node/pulls/237/commits","review_comments_url":"https://api.github.com/repos/swagger-api/swagger-node/pulls/237/comments","review_comment_url":"https://api.github.com/repos/swagger-api/swagger-node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/swagger-api/swagger-node/issues/237/comments","statuses_url":"https://api.github.com/repos/swagger-api/swagger-node/statuses/118c35a292796b2e8a42834eb3556bcd3afb44b7","head":{"label":"elsapeng:cli-testing","ref":"cli-testing","sha":"118c35a292796b2e8a42834eb3556bcd3afb44b7","user":{"login":"elsapeng","id":8696128,"avatar_url":"https://avatars.githubusercontent.com/u/8696128?v=3","gravatar_id":"","url":"https://api.github.com/users/elsapeng","html_url":"https://github.com/elsapeng","followers_url":"https://api.github.com/users/elsapeng/followers","following_url":"https://api.github.com/users/elsapeng/following{/other_user}","gists_url":"https://api.github.com/users/elsapeng/gists{/gist_id}","starred_url":"https://api.github.com/users/elsapeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elsapeng/subscriptions","organizations_url":"https://api.github.com/users/elsapeng/orgs","repos_url":"https://api.github.com/users/elsapeng/repos","events_url":"https://api.github.com/users/elsapeng/events{/privacy}","received_events_url":"https://api.github.com/users/elsapeng/received_events","type":"User","site_admin":false},"repo":{"id":37949580,"name":"swagger-node","full_name":"elsapeng/swagger-node","owner":{"login":"elsapeng","id":8696128,"avatar_url":"https://avatars.githubusercontent.com/u/8696128?v=3","gravatar_id":"","url":"https://api.github.com/users/elsapeng","html_url":"https://github.com/elsapeng","followers_url":"https://api.github.com/users/elsapeng/followers","following_url":"https://api.github.com/users/elsapeng/following{/other_user}","gists_url":"https://api.github.com/users/elsapeng/gists{/gist_id}","starred_url":"https://api.github.com/users/elsapeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elsapeng/subscriptions","organizations_url":"https://api.github.com/users/elsapeng/orgs","repos_url":"https://api.github.com/users/elsapeng/repos","events_url":"https://api.github.com/users/elsapeng/events{/privacy}","received_events_url":"https://api.github.com/users/elsapeng/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/elsapeng/swagger-node","description":"Swagger module for node.js","fork":true,"url":"https://api.github.com/repos/elsapeng/swagger-node","forks_url":"https://api.github.com/repos/elsapeng/swagger-node/forks","keys_url":"https://api.github.com/repos/elsapeng/swagger-node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elsapeng/swagger-node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elsapeng/swagger-node/teams","hooks_url":"https://api.github.com/repos/elsapeng/swagger-node/hooks","issue_events_url":"https://api.github.com/repos/elsapeng/swagger-node/issues/events{/number}","events_url":"https://api.github.com/repos/elsapeng/swagger-node/events","assignees_url":"https://api.github.com/repos/elsapeng/swagger-node/assignees{/user}","branches_url":"https://api.github.com/repos/elsapeng/swagger-node/branches{/branch}","tags_url":"https://api.github.com/repos/elsapeng/swagger-node/tags","blobs_url":"https://api.github.com/repos/elsapeng/swagger-node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elsapeng/swagger-node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elsapeng/swagger-node/git/refs{/sha}","trees_url":"https://api.github.com/repos/elsapeng/swagger-node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elsapeng/swagger-node/statuses/{sha}","languages_url":"https://api.github.com/repos/elsapeng/swagger-node/languages","stargazers_url":"https://api.github.com/repos/elsapeng/swagger-node/stargazers","contributors_url":"https://api.github.com/repos/elsapeng/swagger-node/contributors","subscribers_url":"https://api.github.com/repos/elsapeng/swagger-node/subscribers","subscription_url":"https://api.github.com/repos/elsapeng/swagger-node/subscription","commits_url":"https://api.github.com/repos/elsapeng/swagger-node/commits{/sha}","git_commits_url":"https://api.github.com/repos/elsapeng/swagger-node/git/commits{/sha}","comments_url":"https://api.github.com/repos/elsapeng/swagger-node/comments{/number}","issue_comment_url":"https://api.github.com/repos/elsapeng/swagger-node/issues/comments{/number}","contents_url":"https://api.github.com/repos/elsapeng/swagger-node/contents/{+path}","compare_url":"https://api.github.com/repos/elsapeng/swagger-node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elsapeng/swagger-node/merges","archive_url":"https://api.github.com/repos/elsapeng/swagger-node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elsapeng/swagger-node/downloads","issues_url":"https://api.github.com/repos/elsapeng/swagger-node/issues{/number}","pulls_url":"https://api.github.com/repos/elsapeng/swagger-node/pulls{/number}","milestones_url":"https://api.github.com/repos/elsapeng/swagger-node/milestones{/number}","notifications_url":"https://api.github.com/repos/elsapeng/swagger-node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elsapeng/swagger-node/labels{/name}","releases_url":"https://api.github.com/repos/elsapeng/swagger-node/releases{/id}","created_at":"2015-06-23T22:56:27Z","updated_at":"2015-06-23T22:56:27Z","pushed_at":"2015-06-26T18:41:59Z","git_url":"git://github.com/elsapeng/swagger-node.git","ssh_url":"git@github.com:elsapeng/swagger-node.git","clone_url":"https://github.com/elsapeng/swagger-node.git","svn_url":"https://github.com/elsapeng/swagger-node","homepage":"http://swagger.io","size":2269,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"swagger-api:master","ref":"master","sha":"2704e7f0c6f178b5b09ae73c0a771bfb043ea000","user":{"login":"swagger-api","id":7658037,"avatar_url":"https://avatars.githubusercontent.com/u/7658037?v=3","gravatar_id":"","url":"https://api.github.com/users/swagger-api","html_url":"https://github.com/swagger-api","followers_url":"https://api.github.com/users/swagger-api/followers","following_url":"https://api.github.com/users/swagger-api/following{/other_user}","gists_url":"https://api.github.com/users/swagger-api/gists{/gist_id}","starred_url":"https://api.github.com/users/swagger-api/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swagger-api/subscriptions","organizations_url":"https://api.github.com/users/swagger-api/orgs","repos_url":"https://api.github.com/users/swagger-api/repos","events_url":"https://api.github.com/users/swagger-api/events{/privacy}","received_events_url":"https://api.github.com/users/swagger-api/received_events","type":"Organization","site_admin":false},"repo":{"id":2219738,"name":"swagger-node","full_name":"swagger-api/swagger-node","owner":{"login":"swagger-api","id":7658037,"avatar_url":"https://avatars.githubusercontent.com/u/7658037?v=3","gravatar_id":"","url":"https://api.github.com/users/swagger-api","html_url":"https://github.com/swagger-api","followers_url":"https://api.github.com/users/swagger-api/followers","following_url":"https://api.github.com/users/swagger-api/following{/other_user}","gists_url":"https://api.github.com/users/swagger-api/gists{/gist_id}","starred_url":"https://api.github.com/users/swagger-api/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swagger-api/subscriptions","organizations_url":"https://api.github.com/users/swagger-api/orgs","repos_url":"https://api.github.com/users/swagger-api/repos","events_url":"https://api.github.com/users/swagger-api/events{/privacy}","received_events_url":"https://api.github.com/users/swagger-api/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/swagger-api/swagger-node","description":"Swagger module for node.js","fork":false,"url":"https://api.github.com/repos/swagger-api/swagger-node","forks_url":"https://api.github.com/repos/swagger-api/swagger-node/forks","keys_url":"https://api.github.com/repos/swagger-api/swagger-node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/swagger-api/swagger-node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/swagger-api/swagger-node/teams","hooks_url":"https://api.github.com/repos/swagger-api/swagger-node/hooks","issue_events_url":"https://api.github.com/repos/swagger-api/swagger-node/issues/events{/number}","events_url":"https://api.github.com/repos/swagger-api/swagger-node/events","assignees_url":"https://api.github.com/repos/swagger-api/swagger-node/assignees{/user}","branches_url":"https://api.github.com/repos/swagger-api/swagger-node/branches{/branch}","tags_url":"https://api.github.com/repos/swagger-api/swagger-node/tags","blobs_url":"https://api.github.com/repos/swagger-api/swagger-node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/swagger-api/swagger-node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/swagger-api/swagger-node/git/refs{/sha}","trees_url":"https://api.github.com/repos/swagger-api/swagger-node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/swagger-api/swagger-node/statuses/{sha}","languages_url":"https://api.github.com/repos/swagger-api/swagger-node/languages","stargazers_url":"https://api.github.com/repos/swagger-api/swagger-node/stargazers","contributors_url":"https://api.github.com/repos/swagger-api/swagger-node/contributors","subscribers_url":"https://api.github.com/repos/swagger-api/swagger-node/subscribers","subscription_url":"https://api.github.com/repos/swagger-api/swagger-node/subscription","commits_url":"https://api.github.com/repos/swagger-api/swagger-node/commits{/sha}","git_commits_url":"https://api.github.com/repos/swagger-api/swagger-node/git/commits{/sha}","comments_url":"https://api.github.com/repos/swagger-api/swagger-node/comments{/number}","issue_comment_url":"https://api.github.com/repos/swagger-api/swagger-node/issues/comments{/number}","contents_url":"https://api.github.com/repos/swagger-api/swagger-node/contents/{+path}","compare_url":"https://api.github.com/repos/swagger-api/swagger-node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/swagger-api/swagger-node/merges","archive_url":"https://api.github.com/repos/swagger-api/swagger-node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/swagger-api/swagger-node/downloads","issues_url":"https://api.github.com/repos/swagger-api/swagger-node/issues{/number}","pulls_url":"https://api.github.com/repos/swagger-api/swagger-node/pulls{/number}","milestones_url":"https://api.github.com/repos/swagger-api/swagger-node/milestones{/number}","notifications_url":"https://api.github.com/repos/swagger-api/swagger-node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/swagger-api/swagger-node/labels{/name}","releases_url":"https://api.github.com/repos/swagger-api/swagger-node/releases{/id}","created_at":"2011-08-17T03:51:37Z","updated_at":"2015-06-26T02:17:36Z","pushed_at":"2015-06-26T18:43:04Z","git_url":"git://github.com/swagger-api/swagger-node.git","ssh_url":"git@github.com:swagger-api/swagger-node.git","clone_url":"https://github.com/swagger-api/swagger-node.git","svn_url":"https://github.com/swagger-api/swagger-node","homepage":"http://swagger.io","size":3486,"stargazers_count":628,"watchers_count":628,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":192,"mirror_url":null,"open_issues_count":9,"forks":192,"open_issues":9,"watchers":628,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/swagger-api/swagger-node/pulls/237"},"html":{"href":"https://github.com/swagger-api/swagger-node/pull/237"},"issue":{"href":"https://api.github.com/repos/swagger-api/swagger-node/issues/237"},"comments":{"href":"https://api.github.com/repos/swagger-api/swagger-node/issues/237/comments"},"review_comments":{"href":"https://api.github.com/repos/swagger-api/swagger-node/pulls/237/comments"},"review_comment":{"href":"https://api.github.com/repos/swagger-api/swagger-node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/swagger-api/swagger-node/pulls/237/commits"},"statuses":{"href":"https://api.github.com/repos/swagger-api/swagger-node/statuses/118c35a292796b2e8a42834eb3556bcd3afb44b7"}}}}