mpizenberg / elm-test-rs

Fast and portable executable to run your Elm tests
BSD 3-Clause "New" or "Revised" License
80 stars 13 forks source link

Use the log crate to add multiple verbosity levels #75

Closed mpizenberg closed 3 years ago

mpizenberg commented 3 years ago

By default the verbosity level is 0, which corresponds to the smallest output. For the time being, I didn't pass the verbosity level to the reporter, so it only impacts the Rust and JS code.

$> elm-test-rs

Running 1 tests. To reproduce these results later,
run elm-test-rs with --seed 457886795 and --fuzz 100

◦ TODO: Implement the first test. See https://package.elm-lang.org/packages/elm-explorations/test/latest for how to do this!

TEST RUN INCOMPLETE because there is 1 TODO remaining

Duration: 1 ms
Passed:   0
Failed:   0
Todo:     1

Now with verbosity level 1 (-v)

$> elm-test-rs -v

elm-test-rs 1.0.0-beta for elm 0.19.1
-------------------------------------

✓ Compilation of tests modules succeeded

Running 1 tests. To reproduce these results later,
run elm-test-rs with --seed 2836322517 and --fuzz 100

◦ TODO: Implement the first test. See https://package.elm-lang.org/packages/elm-explorations/test/latest for how to do this!

TEST RUN INCOMPLETE because there is 1 TODO remaining

Duration: 1 ms
Passed:   0
Failed:   0
Todo:     1
Running duration (since Node.js start): 87 ms

With level 2 (-vv)

$> elm-test-rs -vv

elm-test-rs 1.0.0-beta for elm 0.19.1
-------------------------------------

Generating the elm.json for the Runner.elm
The dependencies picked to run the tests are:
{
  "direct": {
    "elm/core": "1.0.5",
    "elm/json": "1.1.3",
    "elm-explorations/test": "1.2.2",
    "mpizenberg/elm-test-runner": "4.0.3"
  },
  "indirect": {
    "elm/html": "1.0.0",
    "elm/random": "1.0.0",
    "elm/time": "1.0.0",
    "elm/virtual-dom": "1.0.2"
  }
}
Finding all potential tests ...
Spent 0.001879386s generating Runner.elm
Compiling the generated templated src/Runner.elm ...
✓ Compilation of tests modules succeeded
Kernel-patching Runner.elm.js ...
Compiling Reporter.elm.js ...
Starting the supervisor ...
Running tests ...

Running 1 tests. To reproduce these results later,
run elm-test-rs with --seed 1447007600 and --fuzz 100

◦ TODO: Implement the first test. See https://package.elm-lang.org/packages/elm-explorations/test/latest for how to do this!

TEST RUN INCOMPLETE because there is 1 TODO remaining

Duration: 1 ms
Passed:   0
Failed:   0
Todo:     1
Running duration (since Node.js start): 101 ms

Level 3 will also add some debugging information.

mpizenberg commented 3 years ago

I changed the logging level to error in the init subcommand so that info is displayed by default. People who don't want to see anything can redirect stderr to /dev/null or maybe later use a --quiet flag if we re-add one.

I think this one is good to merge. Any objections?