mirror of
https://github.com/sstephenson/bats.git
synced 2025-03-04 07:49:50 +01:00
Merge pull request #10 from bats-core/ci-configs
Add Appveyor configuration, update Travis CI configuration, fix macOS bug
This commit is contained in:
commit
55bf719772
15
.appveyor.yml
Normal file
15
.appveyor.yml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
version: 'v0.4.0.{build}'
|
||||||
|
|
||||||
|
build: off
|
||||||
|
|
||||||
|
# This presumes that Git bash is installed at `C:\Program Files\Git` and the
|
||||||
|
# bash we're using is `C:\Program Files\Git\bin\bash.exe`.
|
||||||
|
#
|
||||||
|
# If instead it finds the Windows Subsystem for Linux bash at
|
||||||
|
# `C:\Windows\System32\bash.exe`, it will fail with an error like:
|
||||||
|
# /mnt/c/.../bats-core/test/test_helper.bash: line 1:
|
||||||
|
# syntax error near unexpected token `$'{\r''
|
||||||
|
test_script:
|
||||||
|
- where bash
|
||||||
|
- bash --version
|
||||||
|
- bash -c 'time libexec/bats test'
|
10
.travis.yml
10
.travis.yml
|
@ -1,5 +1,11 @@
|
||||||
language: c
|
language: bash
|
||||||
script: bin/bats --tap test
|
os:
|
||||||
|
- linux
|
||||||
|
- osx
|
||||||
|
|
||||||
|
script:
|
||||||
|
- bash -c 'time bin/bats --tap test'
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
on_success: never
|
on_success: never
|
||||||
|
|
|
@ -218,13 +218,22 @@ bats_debug_trap() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# When running under Bash 3.2.57(1)-release on macOS, the `ERR` trap may not
|
||||||
|
# always fire, but the `EXIT` trap will. For this reason we call it at the very
|
||||||
|
# beginning of `bats_teardown_trap` (the `DEBUG` trap for the call will move
|
||||||
|
# `BATS_CURRENT_STACK_TRACE` to `BATS_PREVIOUS_STACK_TRACE`) and check the value
|
||||||
|
# of `$?` before taking other actions.
|
||||||
bats_error_trap() {
|
bats_error_trap() {
|
||||||
BATS_ERROR_STATUS="$?"
|
local status="$?"
|
||||||
BATS_ERROR_STACK_TRACE=( "${BATS_PREVIOUS_STACK_TRACE[@]}" )
|
if [[ "$status" -ne '0' ]]; then
|
||||||
trap - debug
|
BATS_ERROR_STATUS="$status"
|
||||||
|
BATS_ERROR_STACK_TRACE=( "${BATS_PREVIOUS_STACK_TRACE[@]}" )
|
||||||
|
trap - debug
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
bats_teardown_trap() {
|
bats_teardown_trap() {
|
||||||
|
bats_error_trap
|
||||||
trap "bats_exit_trap" exit
|
trap "bats_exit_trap" exit
|
||||||
local status=0
|
local status=0
|
||||||
teardown >>"$BATS_OUT" 2>&1 || status="$?"
|
teardown >>"$BATS_OUT" 2>&1 || status="$?"
|
||||||
|
|
|
@ -67,6 +67,8 @@ fixtures bats
|
||||||
@test "one failing test" {
|
@test "one failing test" {
|
||||||
run bats "$FIXTURE_ROOT/failing.bats"
|
run bats "$FIXTURE_ROOT/failing.bats"
|
||||||
[ $status -eq 1 ]
|
[ $status -eq 1 ]
|
||||||
|
printf 'lines:\n' >&2
|
||||||
|
printf '%s\n' "${lines[@]}" >&2
|
||||||
[ "${lines[0]}" = '1..1' ]
|
[ "${lines[0]}" = '1..1' ]
|
||||||
[ "${lines[1]}" = 'not ok 1 a failing test' ]
|
[ "${lines[1]}" = 'not ok 1 a failing test' ]
|
||||||
[ "${lines[2]}" = "# (in test file $RELATIVE_FIXTURE_ROOT/failing.bats, line 4)" ]
|
[ "${lines[2]}" = "# (in test file $RELATIVE_FIXTURE_ROOT/failing.bats, line 4)" ]
|
||||||
|
@ -86,6 +88,8 @@ fixtures bats
|
||||||
@test "failing test with significant status" {
|
@test "failing test with significant status" {
|
||||||
STATUS=2 run bats "$FIXTURE_ROOT/failing.bats"
|
STATUS=2 run bats "$FIXTURE_ROOT/failing.bats"
|
||||||
[ $status -eq 1 ]
|
[ $status -eq 1 ]
|
||||||
|
printf 'lines:\n' >&2
|
||||||
|
printf '%s\n' "${lines[@]}" >&2
|
||||||
[ "${lines[3]}" = "# \`eval \"( exit \${STATUS:-1} )\"' failed with status 2" ]
|
[ "${lines[3]}" = "# \`eval \"( exit \${STATUS:-1} )\"' failed with status 2" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,6 +157,8 @@ fixtures bats
|
||||||
cd "$TMP"
|
cd "$TMP"
|
||||||
run bats "$FIXTURE_ROOT/failing.bats"
|
run bats "$FIXTURE_ROOT/failing.bats"
|
||||||
[ $status -eq 1 ]
|
[ $status -eq 1 ]
|
||||||
|
printf 'lines:\n' >&2
|
||||||
|
printf '%s\n' "${lines[@]}" >&2
|
||||||
[ "${lines[2]}" = "# (in test file $FIXTURE_ROOT/failing.bats, line 4)" ]
|
[ "${lines[2]}" = "# (in test file $FIXTURE_ROOT/failing.bats, line 4)" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user