deno_std
deno_std copied to clipboard
test: write test cases for @std/cli/spinner
It seems possible to write test cases for this module using new Deno.Command().spawn()
I'm looking at this. Would I need to create multiple test files in the testdata to be able see different outputs for different scenarios? It seems like I would import Spinner into these testdata files, run different options / scenarios, then run those modules via Deno.Command. I just haven't used Deno.Command a lot. I think this would be a first for tests, so that's why I'm checking first.
const cmd = new Deno.Command(Deno.execPath(), {
args: [
"run",
// this is where I'd run a testdata file cli/testdata/spinner_tests/<scenario-1>.ts
...args,
],
stdout: "piped",
stderr: "piped",
...opts,
});
const process = cmd.spawn();
const output = await process.output();
// assert(outputStuff)
Here's what I started. It seems like it'll work, but just feels weird: https://github.com/JakeAve/deno_std/tree/cli-spinner-tests
done