Closed m90 closed 2 years ago
I wouldn't use it this way, but I support this feature. How would this be enabled? How does the cli
decide whether it reads from stdin
or uses the files (files should actually default to test
like mocha does it)?
Regarding --bundle
I would probably throw an exception.
I think the convention is to just pass -
(as in above example) if you expect data to be read from stdin.
We talked about this in #229 already, but tbh I am not entirely sure if it reads like a yes or a no over there, which is why I am opening this issue.
Proposal: Instead of passing a list of files and a bundling command to Mochify, the (possibly) bundled spec could also be read from
stdin
. This could work like:CLI
Users could invoke the CLI and pass
-
as the spec:which would just pipe the received bundle through to the driver.
API
The API could be extended to either receive a string (files) or a stream (stdin) as the
spec
option:This might also be helpful in gulp-like scenarios (if they still exist).
How does this work in conjunction with
--bundle
?The interesting question is how does this work in case
--bundle
is given. Does Mochify a. disregard the--bundle
option (maybe it refuses to do things in the first place) or b. pipe the stream through to the bundle command itself?Do we even want this?
While I personally would prefer this for passing bundles (as a consumer I do not need to know about Mochify internals but can run my bundling command in total isolation), it also adds some extra complexity to Mochify. Use cases that use code generation or similar (if such even exist) could also just use temp files or similar instead of piping output.