Skip to content

Commit 1862d34

Browse files
committed
Use BATS for testing
Switches testing to the BATS testing framework: https://github.com/bats-core/bats-core
1 parent 62934dc commit 1862d34

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed

test-build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ function build() {
4646
info "Build of ${full_tag} succeeded."
4747

4848
info "Testing ${full_tag}"
49-
docker run --rm -v "$PWD/test-image.sh:/usr/local/bin/test.sh" node:"${full_tag}" test.sh "${full_version}"
49+
export full_tag=${full_tag}
50+
export full_version=${full_version}
51+
bats test-image.bats
5052
}
5153

5254
cd "$(cd "${0%/*}" && pwd -P)" || exit

test-image.bats

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bats
2+
3+
@test "Test for node and version" {
4+
run docker run --rm -it node:"$full_tag" node -e "process.stdout.write(process.versions.node)"
5+
[ "$status" -eq 0 ]
6+
[ "$output" == "${full_version}" ]
7+
}
8+
9+
@test "Test for npm" {
10+
run docker run --rm -it node:"$full_tag" npm --version
11+
[ "$status" -eq 0 ]
12+
}
13+
14+
@test "Test for yarn" {
15+
run docker run --rm -it node:"$full_tag" yarn --version
16+
[ "$status" -eq 0 ]
17+
}

test-image.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)