Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I assert on a command with no output? #1

Open
mojavelinux opened this issue Jan 5, 2018 · 0 comments
Open

How do I assert on a command with no output? #1

mojavelinux opened this issue Jan 5, 2018 · 0 comments

Comments

@mojavelinux
Copy link

mojavelinux commented Jan 5, 2018

The command I'm testing doesn't output anything when it competes successfully. When I run the command with Kapok under this circumstance, Kapok hangs indefinitely waiting for output.

it('should run successfully', () => {
  return Kapok
    .start(CLI, ['generate'])
    .done()
})

What method to I use to assert no output?

I'm currently using a Promise as a workaround, but I'm not sure this is correct:

it('should run successfully', () => {
  return new Promise((resolve) => {
    Kapok
      .start(CLI, ['generate'])
      .on('exit', () => resolve())
  }).then(() => {
    // assert files were created
  })
})
mojavelinux added a commit to mojavelinux/kapok-js that referenced this issue Jan 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant