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

Commit

Permalink
test: fix prompt test
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jun 10, 2018
1 parent 203fe8e commit 68f2ad9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@oclif/tslint": "^1.1.2",
"@types/ansi-styles": "^3.2.0",
"@types/chai": "^4.1.3",
"@types/chai-as-promised": "^7.1.0",
"@types/clean-stack": "^1.3.0",
"@types/extract-stack": "^1.0.0",
"@types/fs-extra": "^5.0.2",
Expand All @@ -39,6 +40,7 @@
"@types/strip-ansi": "^3.0.0",
"@types/supports-color": "^5.3.0",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"concurrently": "^3.5.1",
"eslint": "^4.19.1",
"eslint-config-oclif": "^1.5.1",
Expand Down
12 changes: 9 additions & 3 deletions test/prompt.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import * as chai from 'chai'
import chaiAsPromised from 'chai-as-promised'

chai.use(chaiAsPromised)
const expect = chai.expect

import cli from '../src'

import {expect, fancy} from './fancy'
import {fancy} from './fancy'

describe('prompt', () => {
fancy
Expand Down Expand Up @@ -32,7 +38,7 @@ describe('prompt', () => {
.stdout()
.stderr()
.end('timeouts with no input', async () => {
const response = await cli.prompt('Require input?', {timeout: 100})
expect(response).to.not.exist
await expect(cli.prompt('Require input?', {timeout: 1}))
.to.eventually.be.rejectedWith('timed out')
})
})
16 changes: 14 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@
dependencies:
"@types/color-name" "*"

"@types/chai@^4.1.3":
"@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.3":
version "4.1.3"
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.1.3.tgz#b8a74352977a23b604c01aa784f5b793443fb7dc"

Expand Down Expand Up @@ -225,6 +231,12 @@ cardinal@^2.1.1:
ansicolors "~0.3.2"
redeyed "~2.1.0"

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 @@ -276,7 +288,7 @@ chardet@^0.4.0:
version "0.4.2"
resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2"

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 68f2ad9

Please sign in to comment.