Skip to content
This repository has been archived by the owner on Dec 29, 2021. It is now read-only.

cli process spawning test module #6

Open
max-mapper opened this issue Aug 4, 2014 · 2 comments
Open

cli process spawning test module #6

max-mapper opened this issue Aug 4, 2014 · 2 comments

Comments

@max-mapper
Copy link
Contributor

for testing cli modules more better we need a module that:

  • is designed around use with tape e.g. you pass in a tape test instance
  • uses tree-kill to cleanup child processes after the test is done
  • uses win-spawn to spawn processes correctly on windows
  • has a debug mode where if you do e.g. DEBUG=* npm test it will stream the child process stdout/stderr to the parent stdout/stderr
  • lets you choose how to handle child stdout/stderr output in a few different ways
    • buffer all stdout or stderr output (or both)
    • get the first buffer of output from stdout/stderr (one or the other or either)
    • do a e.g. regex match or string indexof against output
  • for all of the above it should be impossible for the child processes to become zombies if the tests crash

for reference/inspiration: https://github.com/maxogden/dat/blob/master/test/tests/cli.js#L332

@max-mapper
Copy link
Contributor Author

@sindresorhus how do you test CLI modules cleanly? know anything that fits our criteria above?

@sindresorhus
Copy link

I don't [cleanly]. I've just been lazy using spawning and checking, but this sounds really good. I could definitely use something like this.

Regarding win-spawn: https://github.com/IndigoUnited/node-cross-spawn#why

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants