Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:findmypast-oss/jackal
Browse files Browse the repository at this point in the history
  • Loading branch information
Donald Robertson committed Apr 26, 2017
2 parents 0be0d6d + bef9e62 commit 340ad00
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const errorWrapper = (fn) => function () {
const exitCodeHandler = (err) => {
if (err) {
/* eslint-disable no-console */
console.error(prettyError.render(err))
console.error(prettyError.withoutColors().render(err))
/* eslint-enble no-console */
process.exit(1)
}
Expand Down
2 changes: 1 addition & 1 deletion cli/reporter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const loggers = {
const statusErrorMap = {
SKIPPED: null,
ERROR: 'Aborting',
NO_CONTRACTS: 'No contracts found',
NO_CONTRACTS: null,
INVALID: 'Invalid contracts',
FAILED: 'Tests failed',
PASSED: null
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jackal",
"version": "1.0.13",
"version": "1.0.14",
"description": "Consumer Driven Contracts Service",
"main": "index.js",
"bin": {
Expand Down
60 changes: 30 additions & 30 deletions test/integration/cli/run.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ describe('CLI.Run Integration Test', function () {
}

exec(`node index run -r json http://localhost:${port} provider_three`, (err, stdout, stderr) => {
expect(err).to.exist
expect(err).not.to.exist
expect(JSON.parse(stdout)).to.eql(expected)
expect(stderr).not.to.equal('')
expect(stderr).to.equal('')
done()
})
})
Expand Down Expand Up @@ -217,9 +217,9 @@ describe('CLI.Run Integration Test', function () {
}

exec(`node index run -r json http://localhost:${port} provider_one`, (err, stdout, stderr) => {
expect(err).to.exist
expect(err).not.to.exist
expect(JSON.parse(stdout)).to.eql(expected)
expect(stderr).not.to.equal('')
expect(stderr).to.equal('')
done()
})
})
Expand All @@ -232,9 +232,9 @@ describe('CLI.Run Integration Test', function () {
}

exec(`node index run -r json -p http://localhost:8381 http://localhost:${port} provider_one`, (err, stdout, stderr) => {
expect(err).to.exist
expect(err).not.to.exist
expect(JSON.parse(stdout)).to.eql(expected)
expect(stderr).not.to.equal('')
expect(stderr).to.equal('')
done()
})
})
Expand All @@ -247,9 +247,9 @@ describe('CLI.Run Integration Test', function () {
}

exec(`node index run -r json http://localhost:${port} provider_two`, (err, stdout, stderr) => {
expect(err).to.exist
expect(err).not.to.exist
expect(JSON.parse(stdout)).to.eql(expected)
expect(stderr).not.to.equal('')
expect(stderr).to.equal('')
done()
})
})
Expand All @@ -262,9 +262,9 @@ describe('CLI.Run Integration Test', function () {
}

exec(`node index run -r json -p http://localhost:8382 http://localhost:${port} provider_two`, (err, stdout, stderr) => {
expect(err).to.exist
expect(err).not.to.exist
expect(JSON.parse(stdout)).to.eql(expected)
expect(stderr).not.to.equal('')
expect(stderr).to.equal('')
done()
})
})
Expand Down Expand Up @@ -363,9 +363,9 @@ describe('CLI.Run Integration Test', function () {
const expected = 'No contracts exist for provider: provider_three\n'

exec(`node index run -r spec http://localhost:${port} provider_three`, (err, stdout, stderr) => {
expect(err).to.exist
expect(err).not.to.exist
expect(stdout).to.equal(expected)
expect(stderr).not.to.equal('')
expect(stderr).to.equal('')
done()
})
})
Expand Down Expand Up @@ -418,9 +418,9 @@ describe('CLI.Run Integration Test', function () {
const expected = 'No contracts exist for provider: provider_one\n'

exec(`node index run -r spec http://localhost:${port} provider_one`, (err, stdout, stderr) => {
expect(err).to.exist
expect(err).not.to.exist
expect(stdout).to.equal(expected)
expect(stderr).not.to.equal('')
expect(stderr).to.equal('')
done()
})
})
Expand All @@ -429,9 +429,9 @@ describe('CLI.Run Integration Test', function () {
const expected = 'No contracts exist for provider: provider_one\n'

exec(`node index run -r spec -p http://localhost:8381 http://localhost:${port} provider_one`, (err, stdout, stderr) => {
expect(err).to.exist
expect(err).not.to.exist
expect(stdout).to.equal(expected)
expect(stderr).not.to.equal('')
expect(stderr).to.equal('')
done()
})
})
Expand All @@ -440,9 +440,9 @@ describe('CLI.Run Integration Test', function () {
const expected = 'No contracts exist for provider: provider_two\n'

exec(`node index run -r spec http://localhost:${port} provider_two`, (err, stdout, stderr) => {
expect(err).to.exist
expect(err).not.to.exist
expect(stdout).to.equal(expected)
expect(stderr).not.to.equal('')
expect(stderr).to.equal('')
done()
})
})
Expand All @@ -451,9 +451,9 @@ describe('CLI.Run Integration Test', function () {
const expected = 'No contracts exist for provider: provider_two\n'

exec(`node index run -r spec -p http://localhost:8382 http://localhost:${port} provider_two`, (err, stdout, stderr) => {
expect(err).to.exist
expect(err).not.to.exist
expect(stdout).to.equal(expected)
expect(stderr).not.to.equal('')
expect(stderr).to.equal('')
done()
})
})
Expand Down Expand Up @@ -552,9 +552,9 @@ describe('CLI.Run Integration Test', function () {
const expected = 'No contracts exist for provider: provider_three\n'

exec(`node index run -r teamcity http://localhost:${port} provider_three`, (err, stdout, stderr) => {
expect(err).to.exist
expect(err).not.to.exist
expect(stdout).to.equal(expected)
expect(stderr).not.to.equal('')
expect(stderr).to.equal('')
done()
})
})
Expand Down Expand Up @@ -607,9 +607,9 @@ describe('CLI.Run Integration Test', function () {
const expected = 'No contracts exist for provider: provider_one\n'

exec(`node index run -r teamcity http://localhost:${port} provider_one`, (err, stdout, stderr) => {
expect(err).to.exist
expect(err).not.to.exist
expect(stdout).to.equal(expected)
expect(stderr).not.to.equal('')
expect(stderr).to.equal('')
done()
})
})
Expand All @@ -618,9 +618,9 @@ describe('CLI.Run Integration Test', function () {
const expected = 'No contracts exist for provider: provider_one\n'

exec(`node index run -r teamcity -p http://localhost:8381 http://localhost:${port} provider_one`, (err, stdout, stderr) => {
expect(err).to.exist
expect(err).not.to.exist
expect(stdout).to.equal(expected)
expect(stderr).not.to.equal('')
expect(stderr).to.equal('')
done()
})
})
Expand All @@ -629,9 +629,9 @@ describe('CLI.Run Integration Test', function () {
const expected = 'No contracts exist for provider: provider_two\n'

exec(`node index run -r teamcity http://localhost:${port} provider_two`, (err, stdout, stderr) => {
expect(err).to.exist
expect(err).not.to.exist
expect(stdout).to.equal(expected)
expect(stderr).not.to.equal('')
expect(stderr).to.equal('')
done()
})
})
Expand All @@ -640,9 +640,9 @@ describe('CLI.Run Integration Test', function () {
const expected = 'No contracts exist for provider: provider_two\n'

exec(`node index run -r teamcity -p http://localhost:8382 http://localhost:${port} provider_two`, (err, stdout, stderr) => {
expect(err).to.exist
expect(err).not.to.exist
expect(stdout).to.equal(expected)
expect(stderr).not.to.equal('')
expect(stderr).to.equal('')
done()
})
})
Expand Down
20 changes: 10 additions & 10 deletions test/integration/cli/send.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ describe('CLI.Send Integration Test', function () {
})

context('with missing contracts', function () {
const stderrOutput = ' \u001b[0m\u001b[97m\u001b[41mError\u001b[0m\u001b[90m:\u001b[0m\u001b[37m \u001b[0m\u001b[97mMissing contract file test/contracts/missing-contracts-file.json\u001b[0m\n\u001b[0m\n'
const stderrOutput = '.*Error:.*Missing contract file test/contracts/missing-contracts-file.json.*'

context('using the JSON reporter', function () {
let port, dbPath, options
Expand All @@ -751,13 +751,13 @@ describe('CLI.Send Integration Test', function () {
})

it('should return an error advising the contracts file is missing', function (done) {
const errMessage = 'Command failed: node index send -r json http://localhost:8378 test/contracts/missing-contracts-file.json\n \u001b[0m\u001b[97m\u001b[41mError\u001b[0m\u001b[90m:\u001b[0m\u001b[37m \u001b[0m\u001b[97mMissing contract file test/contracts/missing-contracts-file.json\u001b[0m\n\u001b[0m\n'
const errMessage = `Command failed: node index send -r json http://localhost:8378 test/contracts/missing-contracts-file.json\n ${stderrOutput}`

exec(`node index send -r json http://localhost:${port} test/contracts/missing-contracts-file.json`, (err, stdout, stderr) => {
expect(err.message).to.equal(errMessage)
expect(err.message).to.match(new RegExp(errMessage))
expect(err.code).to.equal(1)
expect(stdout).to.equal('')
expect(stderr).to.equal(stderrOutput)
expect(stderr).to.match(new RegExp(stderrOutput))

done()
})
Expand Down Expand Up @@ -789,13 +789,13 @@ describe('CLI.Send Integration Test', function () {
})

it('should return an error advising the contracts file is missing', function (done) {
const errMessage = 'Command failed: node index send -r spec http://localhost:8378 test/contracts/missing-contracts-file.json\n \u001b[0m\u001b[97m\u001b[41mError\u001b[0m\u001b[90m:\u001b[0m\u001b[37m \u001b[0m\u001b[97mMissing contract file test/contracts/missing-contracts-file.json\u001b[0m\n\u001b[0m\n'
const errMessage = `Command failed: node index send -r spec http://localhost:8378 test/contracts/missing-contracts-file.json\n ${stderrOutput}`

exec(`node index send -r spec http://localhost:${port} test/contracts/missing-contracts-file.json`, (err, stdout, stderr) => {
expect(err.message).to.equal(errMessage)
expect(err.message).to.match(new RegExp(errMessage))
expect(err.code).to.equal(1)
expect(stdout).to.equal('')
expect(stderr).to.equal(stderrOutput)
expect(stderr).to.match(new RegExp(stderrOutput))

done()
})
Expand Down Expand Up @@ -827,13 +827,13 @@ describe('CLI.Send Integration Test', function () {
})

it('should return an error advising the contracts file is missing', function (done) {
const errMessage = 'Command failed: node index send -r teamcity http://localhost:8378 test/contracts/missing-contracts-file.json\n \u001b[0m\u001b[97m\u001b[41mError\u001b[0m\u001b[90m:\u001b[0m\u001b[37m \u001b[0m\u001b[97mMissing contract file test/contracts/missing-contracts-file.json\u001b[0m\n\u001b[0m\n'
const errMessage = `Command failed: node index send -r teamcity http://localhost:8378 test/contracts/missing-contracts-file.json\n ${stderrOutput}`

exec(`node index send -r teamcity http://localhost:${port} test/contracts/missing-contracts-file.json`, (err, stdout, stderr) => {
expect(err.message).to.equal(errMessage)
expect(err.message).to.match(new RegExp(errMessage))
expect(err.code).to.equal(1)
expect(stdout).to.equal('')
expect(stderr).to.equal(stderrOutput)
expect(stderr).to.match(new RegExp(stderrOutput))

done()
})
Expand Down

0 comments on commit 340ad00

Please sign in to comment.