Skip to content

Commit

Permalink
feat: add chai-as-promised
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jan 16, 2018
1 parent 08d0560 commit 4d45e11
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
"@dxcli/dev-nyc-config": "^0.0.3",
"@types/ansi-styles": "^2.0.30",
"@types/chai": "^4.1.0",
"@types/chai-as-promised": "^7.1.0",
"@types/lodash": "^4.14.92",
"@types/mocha": "^2.2.46",
"@types/strip-ansi": "^3.0.0",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"lodash": "^4.17.4",
"mocha-junit-reporter": "^1.15.0",
"std-mocks": "^1.0.1",
Expand All @@ -20,7 +22,7 @@
"devDependencies": {
"@dxcli/dev": "^1.1.3",
"@dxcli/dev-semantic-release": "^0.0.3",
"@dxcli/dev-tslint": "^0.0.9",
"@dxcli/dev-tslint": "^0.0.12",
"@types/node": "^9.3.0",
"eslint": "^4.15.0",
"eslint-config-dxcli": "^1.1.4",
Expand Down
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// tslint:disable no-namespace

import * as chai from 'chai'
import * as chaiAsPromised from 'chai-as-promised'
import * as _ from 'lodash'
import * as mocha from 'mocha'
import stripAnsi = require('strip-ansi')
export {expect} from 'chai'

chai.use(chaiAsPromised)

const stdMocks = require('std-mocks')

Expand Down Expand Up @@ -125,8 +128,10 @@ const __it = (options: Options = {}): It => {

const _describe = __describe()
const _it = __it()
const expect = chai.expect

export {
_describe as describe,
_it as it,
expect,
}
6 changes: 6 additions & 0 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,9 @@ describe.env({foo: 'bar'})('mock env', () => {
expect(process.env).to.deep.equal({})
})
})

describe('chai-as-promised', () => {
it('eventually expects', async () => {
await expect(Promise.resolve('foo')).to.eventually.equal('foo')
})
})
22 changes: 17 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@
"@semantic-release/npm" "^2.6.1"
semantic-release "^12.2.0"

"@dxcli/dev-tslint@^0.0.9":
version "0.0.9"
resolved "https://registry.yarnpkg.com/@dxcli/dev-tslint/-/dev-tslint-0.0.9.tgz#552b62b769ede24b30fdc3b8c04e10b1a60f027f"
"@dxcli/dev-tslint@^0.0.12":
version "0.0.12"
resolved "https://registry.yarnpkg.com/@dxcli/dev-tslint/-/dev-tslint-0.0.12.tgz#fe00df29d715779ee729d26420f763dd735c9e97"
dependencies:
tslint "^5.9.1"
tslint-xo "^0.5.0"
Expand Down Expand Up @@ -258,7 +258,13 @@
version "2.0.30"
resolved "https://registry.yarnpkg.com/@types/ansi-styles/-/ansi-styles-2.0.30.tgz#9a645299020a224afc6a8cd055195850b3c2af85"

"@types/chai@^4.1.0":
"@types/chai-as-promised@^7.1.0":
version "7.1.0"
resolved "https://registry.yarnpkg.com/@types/chai-as-promised/-/chai-as-promised-7.1.0.tgz#010b04cde78eacfb6e72bfddb3e58fe23c2e78b9"
dependencies:
"@types/chai" "*"

"@types/chai@*", "@types/chai@^4.1.0":
version "4.1.0"
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.1.0.tgz#d9008fa4c06f6801f93396d121f0227cd4244ac6"

Expand Down Expand Up @@ -722,6 +728,12 @@ center-align@^0.1.1:
align-text "^0.1.3"
lazy-cache "^1.0.3"

chai-as-promised@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/chai-as-promised/-/chai-as-promised-7.1.1.tgz#08645d825deb8696ee61725dbf590c012eb00ca0"
dependencies:
check-error "^1.0.2"

chai@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/chai/-/chai-4.1.2.tgz#0f64584ba642f0f2ace2806279f4f06ca23ad73c"
Expand Down Expand Up @@ -769,7 +781,7 @@ charenc@~0.0.1:
version "0.0.2"
resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667"

check-error@^1.0.1:
check-error@^1.0.1, check-error@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82"

Expand Down

0 comments on commit 4d45e11

Please sign in to comment.