commander-cli/commander

View on GitHub
integration/unix/commander_test.yaml

Summary

Maintainability
Test Coverage
tests:
  it should fail:
    command: /bin/bash invalid
    stderr: "/bin/bash: invalid: No such file or directory"
    exit-code: 127

  it should exit with error code:
      command: exit 1
      exit-code: 1

  it should assert stdout:
      command: echo hello
      stdout: hello
      exit-code: 0

  it should assert stderr:
      command: '>&2 echo "error"'
      stderr: error
      exit-code: 0

  it should assert line-count:
    command: printf "hello\nline2"
    stdout:
      line-count: 2
    exit-code: 0

  it should assert zero line count:
    command: exit 0
    stdout:
      line-count: 0
    exit-code: 0

  it should assert a specifc line:
    command: printf "line1\nline2\nline3\nline4"
    stdout:
      lines:
        1: line1
        2: line2
        4: line4
    exit-code: 0

  it should validate not contains:
    command: echo lorem ipsum
    stdout:
      not-contains:
        - not contains

  it should assert json:
    command: cat ./integration/unix/_fixtures/book.json
    stdout:
      json:
        books.0.author: J. R. R. Tolkien
        books.1.author: Joanne K. Rowling

  it should assert xml:
    command: cat ./integration/unix/_fixtures/book.xml
    stdout:
      xml:
        /books/0/author: J. R. R. Tokien
        /books/1/author: Joanne K. Rowling

  it should assert file contents on stdout:
    command: cat ./integration/unix/_fixtures/big_out.txt
    stdout:
      file: ./integration/unix/_fixtures/big_out.txt

  it should assert file contents on stderr:
    command: cat ./integration/unix/_fixtures/big_out.txt >&2
    stderr:
      file: ./integration/unix/_fixtures/big_out.txt

  it should handle a trailing newline in the file:
    command: cat ./integration/unix/_fixtures/trailing_newline.txt
    stdout:
      file: ./integration/unix/_fixtures/trailing_newline.txt

  it should inherit from parent env:
    config:
      inherit-env: true
    command: echo $USER
    stdout: from_parent
    exit-code: 0
  
  it should skip:
    command: whoami
    stdout: root
    skip: true