commander-cli/commander

View on GitHub
commander_unix.yaml

Summary

Maintainability
Test Coverage
tests:
  it should fail with invalid argument:
    command: ./commander asfdf
    exit-code: 3

  it should display help:
    command: ./commander
    exit-code: 0

  it should execute tests:
    config:
      env:
        USER: from_parent
    command: ./commander test ./integration/unix/commander_test.yaml
    stdout:
      contains:
        - ✓ [local] it should exit with error code
        - "- [local] it should skip, was skipped"
      line-count: 20
    exit-code: 0

  it should assert that commander will fail:
    command: ./commander test ./integration/unix/failing_suite.yaml
    stdout:
      contains:
        - ✗ [local] 'file matcher should fail when file and output are different', on property 'Stdout'
        - ✗ [local] 'it will fail', on property 'ExitCode'
        - ✗ [local] 'test timeout' could not be executed with error message
        - Command timed out after 10ms
        - "Count: 3, Failed: 3"
    exit-code: 1

  it should validate a big output:
    command: ./commander test ./integration/unix/test_big_output.yaml
    stdout:
      contains:
        - ✓ [local] cat ./integration/unix/_fixtures/big_out.txt
        - "Count: 1, Failed: 0"
    exit-code: 0

  test global and local configurations:
    command: ./commander test ./integration/unix/config_test.yaml
    config:
      env:
        COMMANDER_FROM_SHELL: from_shell
    stdout:
      contains:
        - ✓ [local] should print global env value
        - ✓ [local] should print local env value
        - ✓ [local] should print env var from shell
    exit-code: 0

  test add command:
    command: ./commander add --no-file --stdout "echo hello"
    stdout: |-
      tests:
        echo hello:
          exit-code: 0
          stdout: hello
    exit-code: 0

  test retries:
    command: ./commander test integration/unix/retries.yaml
    stdout:
      contains:
        - ✗ [local] echo hello, retries 3
        - ✓ [local] it should retry failed commands, retries 2
        - ✗ [local] it should retry failed commands with an interval, retries 2
    exit-code: 1

  test directory order:
    command: ./commander test --dir integration/unix/directory_test/
    stdout: 
      lines:
        3: ✓ [alpha_test.yaml] [local] sleep test
        4: ✓ [beta_test.yaml] [local] ehco hello
  
  test missing dir flag:
    command: ./commander test integration/unix/directory_test/
    stdout: 
      contains:
        - 'integration/unix/directory_test/: is a directory'
    exit-code: 1

  test filter flag works:
    command: ./commander test integration/unix/filter_test.yaml --filter=executed
    stdout:
      contains:
        - ✓ [local] should be executed
        - ✓ [local] should also be executed
      not-contains:
        - should be filtered
    exit-code: 0

  test filter flag with regex:
    command: ./commander test integration/unix/filter_test.yaml --filter="executed$"
    stdout:
      contains:
        - ✓ [local] should be executed
        - ✓ [local] should also be executed
      not-contains:
        - should be ignored
        - executed at the beginning is ignored
    exit-code: 0

  test mulitple filters:
    command: ./commander test integration/unix/filter_test.yaml --filter="executed$" --filter="should be ignored"
    stdout:
      contains:
        - ✓ [local] should be executed
        - ✓ [local] should also be executed
        - ✓ [local] should be ignored
      not-contains:
        - executed at the beginning is ignored
    exit-code: 0

  it should be executed in alphabetical order:
    command: ./commander test integration/unix/alphabetically_order.yaml
    stdout:
      contains:
      - |-
        ✓ [local] ---
        ✓ [local] 123
        ✓ [local] a
        ✓ [local] b
    exit-code: 0

  it should execute test from url:
    skip: false
    config:
      env:
        USER: from_parent
    command: ./commander test https://raw.githubusercontent.com/commander-cli/commander/master/integration/unix/remote_http.yaml
    stdout:
      contains:
        - ✓ [local] hello world
    exit-code: 0

  test stdin input:
    command: cat integration/unix/stdin.yaml | ./commander test -
    stdout:
      contains:
        - ✓ [local] hello world
    exit-code: 0

  test workdir flag:
    command: ./commander test --workdir integration/unix/ workdir.yaml
    stdout:
      contains:
        - ✓ [local] echo hello
    exit-code: 0

  test config flag:
    command: ./commander test --config integration/unix/_fixtures/overwrite_config.yaml integration/unix/overwrite.yaml
    stdout:
      contains:
        - ✗ [local] echo hello, retries 2
        - ✗ [local] should retry 3 times, retries 3
        - ✓ [local] should use key from config
        - ✓ [local] should use dir from config
    exit-code: 1