Skip to content

Commit

Permalink
test: add tersify test for asyncError
Browse files Browse the repository at this point in the history
chore: enable codecov
  • Loading branch information
unional committed Jan 10, 2018
1 parent c243909 commit 41607f5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ after_script: greenkeeper-lockfile-upload
after_success:
- npm run travis-deploy-once "npm run semantic-release"
- npm install --no-save coveralls && npm run coveralls
- npm install --no-save codecov && npm run codecov
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"build-es5": "tsc -p tsconfig.es5.json",
"build-es2015": "tsc -p tsconfig.es2015.json",
"clean": "rimraf dist dist-es5 && rimraf dist-es2015",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json",
"coverage": "nyc npm test",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"dependency-check": "dependency-check . --unused --no-dev && dependency-check . --missing --no-dev",
Expand Down Expand Up @@ -72,6 +73,6 @@
"typescript": "^2.6.2"
},
"dependencies": {
"tersify": "^0.3.0"
"tersify": "^1.0.1"
}
}
15 changes: 15 additions & 0 deletions src/spy.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { test } from 'ava'

import { spy } from './index'
import { tersify } from 'tersify';

function increment(x: number) { return ++x }

Expand Down Expand Up @@ -99,3 +100,17 @@ test('catch() will receive error thrown by promise', async t => {
})
})
})

test('tersify for sync call', async t => {
const { fn, calls } = spy(reject)


return fn(1).catch(actualError => {
console.log(tersify(actualError))
return calls[0].getCallRecord()
.then(record => {
t.is(record.tersify(), `{ inputs: [1], output: {}, error: undefined, asyncError: { message: '1' } }`)
})
})
})

0 comments on commit 41607f5

Please sign in to comment.