Use BATS for testing
Switches testing to the BATS testing framework: https://github.com/bats-core/bats-core
This commit is contained in:
parent
b22fb6c84e
commit
3bfd15f786
|
@ -46,7 +46,9 @@ function build() {
|
|||
info "Build of ${full_tag} succeeded."
|
||||
|
||||
info "Testing ${full_tag}"
|
||||
docker run --rm -v "$PWD/test-image.sh:/usr/local/bin/test.sh" node:"${full_tag}" test.sh "${full_version}"
|
||||
export full_tag=${full_tag}
|
||||
export full_version=${full_version}
|
||||
bats test-image.bats
|
||||
}
|
||||
|
||||
cd "$(cd "${0%/*}" && pwd -P)" || exit
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env bats
|
||||
|
||||
@test "Test for node and version" {
|
||||
run docker run --rm -it node:"$full_tag" node -e "process.stdout.write(process.versions.node)"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" == "${full_version}" ]
|
||||
}
|
||||
|
||||
@test "Test for npm" {
|
||||
run docker run --rm -it node:"$full_tag" npm --version
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "Test for yarn" {
|
||||
run docker run --rm -it node:"$full_tag" yarn --version
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
#!/bin/sh
|
||||
if [ "$(node -e "process.stdout.write(process.versions.node)")" != "${1}" ]; then
|
||||
echo "Test for node failed!"
|
||||
exit 1
|
||||
fi
|
||||
echo "Test for node succeeded."
|
||||
|
||||
if ! npm --version >/dev/null; then
|
||||
echo "Test for npm failed!"
|
||||
exit 1
|
||||
fi
|
||||
echo "Test for npm succeeded."
|
||||
|
||||
if ! yarn --version >/dev/null; then
|
||||
echo "Test of yarn failed!"
|
||||
exit 1
|
||||
fi
|
||||
echo "Test for yarn succeeded."
|
Loading…
Reference in New Issue