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

test: write test cases for @std/cli/spinner #4672

Closed
kt3k opened this issue May 2, 2024 · 3 comments
Closed

test: write test cases for @std/cli/spinner #4672

kt3k opened this issue May 2, 2024 · 3 comments

Comments

@kt3k
Copy link
Member

kt3k commented May 2, 2024

It seems possible to write test cases for this module using new Deno.Command().spawn()

@JakeAve
Copy link
Contributor

JakeAve commented May 10, 2024

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)

@JakeAve
Copy link
Contributor

JakeAve commented May 10, 2024

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

@kt3k
Copy link
Member Author

kt3k commented May 13, 2024

done

@kt3k kt3k closed this as completed May 13, 2024
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

2 participants