diff options
| author | Gregg Caines <[email protected]> | 2013-08-24 18:00:40 -0700 |
|---|---|---|
| committer | Gregg Caines <[email protected]> | 2013-08-24 18:00:40 -0700 |
| commit | 0c817523ee2a74a7912250056f474156dc755100 (patch) | |
| tree | b3ac61d91440216fddc7537cf1af8090fd4b6cc8 /test/getOptions.js | |
| parent | 829e407f57e6a0abb15cafd69a0983165777535b (diff) | |
| download | node-coveralls-0c817523ee2a74a7912250056f474156dc755100.tar.xz node-coveralls-0c817523ee2a74a7912250056f474156dc755100.zip | |
removed exec-sync. version 2.2.0 candidate
Diffstat (limited to 'test/getOptions.js')
| -rw-r--r-- | test/getOptions.js | 114 |
1 files changed, 71 insertions, 43 deletions
diff --git a/test/getOptions.js b/test/getOptions.js index ba3b7f0..67276af 100644 --- a/test/getOptions.js +++ b/test/getOptions.js @@ -5,77 +5,105 @@ describe("getOptions", function(){ beforeEach(function(){ process.env = {}; }); - it ("should get a filepath if there is one", function(){ + it ("should get a filepath if there is one", function(done){ process.argv[2] = "somepath"; - getOptions().filepath.should.equal("somepath"); + getOptions(function(err, options){ + options.filepath.should.equal("somepath"); + done(); + }); }); - it ("should get a filepath if there is one, even in verbose mode", function(){ + it ("should get a filepath if there is one, even in verbose mode", function(done){ process.argv[2] = "--verbose"; process.argv[3] = "somepath"; - getOptions().filepath.should.equal("somepath"); + getOptions(function(err, options){ + options.filepath.should.equal("somepath"); + done(); + }); }); - it ("should set service_job_id if it exists", function(){ + it ("should set service_job_id if it exists", function(done){ process.env.COVERALLS_SERVICE_JOB_ID = "SERVICE_JOB_ID"; - getOptions().service_job_id.should.equal("SERVICE_JOB_ID"); + getOptions(function(err, options){ + options.service_job_id.should.equal("SERVICE_JOB_ID"); + done(); + }); }); - it ("should set git hash if it exists", function(){ + it ("should set git hash if it exists", function(done){ process.env.COVERALLS_GIT_COMMIT = "e3e3e3e3e3e3e3e3e"; - getOptions().git.head.id.should.equal("e3e3e3e3e3e3e3e3e"); + getOptions(function(err, options){ + options.git.head.id.should.equal("e3e3e3e3e3e3e3e3e"); + done(); + }); }); - it ("should set git hash if it exists", function(){ + it ("should set git hash if it exists", function(done){ process.env.COVERALLS_GIT_COMMIT = "e3e3e3e3e3e3e3e3e"; process.env.COVERALLS_GIT_BRANCH = "master"; - getOptions().git.branch.should.equal("master"); + getOptions(function(err, options){ + options.git.branch.should.equal("master"); + done(); + }); }); - it ("should set repo_token if it exists", function(){ + it ("should set repo_token if it exists", function(done){ process.env.COVERALLS_REPO_TOKEN = "REPO_TOKEN"; - getOptions().repo_token.should.equal("REPO_TOKEN"); + getOptions(function(err, options){ + options.repo_token.should.equal("REPO_TOKEN"); + done(); + }); }); - it ("should set service_name if it exists", function(){ + it ("should set service_name if it exists", function(done){ process.env.COVERALLS_SERVICE_NAME = "SERVICE_NAME"; - getOptions().service_name.should.equal("SERVICE_NAME"); + getOptions(function(err, options){ + options.service_name.should.equal("SERVICE_NAME"); + done(); + }); }); - it ("should set service_name and service_job_id if it's running on travis-ci", function(){ + it ("should set service_name and service_job_id if it's running on travis-ci", function(done){ process.env.TRAVIS = "TRUE"; process.env.TRAVIS_JOB_ID = "1234"; - getOptions().service_name.should.equal("travis-ci"); - getOptions().service_job_id.should.equal("1234"); + getOptions(function(err, options){ + options.service_name.should.equal("travis-ci"); + options.service_job_id.should.equal("1234"); + done(); + }); }); - it ("should set service_name and service_job_id if it's running on jenkins", function(){ + it ("should set service_name and service_job_id if it's running on jenkins", function(done){ process.env.JENKINS_URL = "something"; process.env.BUILD_ID = "1234"; process.env.GIT_COMMIT = "a12s2d3df4f435g45g45g67h5g6"; process.env.GIT_BRANCH = "master"; - var options = getOptions(); - options.service_name.should.equal("jenkins"); - options.service_job_id.should.equal("1234"); - options.git.should.eql({ head: - { id: 'a12s2d3df4f435g45g45g67h5g6', - author_name: 'Unknown Author', - author_email: '', - committer_name: 'Unknown Committer', - committer_email: '', - message: 'Unknown Commit Message' }, - branch: 'master', - remotes: [] }); + getOptions(function(err, options){ + options.service_name.should.equal("jenkins"); + options.service_job_id.should.equal("1234"); + options.git.should.eql({ head: + { id: 'a12s2d3df4f435g45g45g67h5g6', + author_name: 'Unknown Author', + author_email: '', + committer_name: 'Unknown Committer', + committer_email: '', + message: 'Unknown Commit Message' }, + branch: 'master', + remotes: [] }); + done(); + }); }); - it ("should set service_name and service_job_id if it's running on circleci", function(){ + it ("should set service_name and service_job_id if it's running on circleci", function(done){ process.env.CIRCLECI = true; process.env.CIRCLE_BRANCH = "master"; process.env.CIRCLE_BUILD_NUM = "1234"; process.env.CIRCLE_SHA1 = "e3e3e3e3e3e3e3e3e"; - var options = getOptions(); - options.service_name.should.equal("circleci"); - options.service_job_id.should.equal("1234"); - options.git.should.eql({ head: - { id: 'e3e3e3e3e3e3e3e3e', - author_name: 'Unknown Author', - author_email: '', - committer_name: 'Unknown Committer', - committer_email: '', - message: 'Unknown Commit Message' }, - branch: 'master', - remotes: [] }); + getOptions(function(err, options){ + options.service_name.should.equal("circleci"); + options.service_job_id.should.equal("1234"); + options.git.should.eql({ head: + { id: 'e3e3e3e3e3e3e3e3e', + author_name: 'Unknown Author', + author_email: '', + committer_name: 'Unknown Committer', + committer_email: '', + message: 'Unknown Commit Message' }, + branch: 'master', + remotes: [] }); + done(); }); + }); }); |
