-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
46 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "test/bats"] | ||
path = test/bats | ||
url = https://github.com/bats-core/bats-core.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
setup() { | ||
tmp_file=$(mktemp) | ||
echo 'console.log("success")' > "${tmp_file}" | ||
} | ||
|
||
@test "Test for node version" { | ||
run docker run --rm "${IMAGE_TAG}" node --print "process.versions.node" | ||
[ "$output" = "${NODE_VERSION}" ] | ||
} | ||
|
||
@test "Test for node version, without directly invoking node" { | ||
run docker run --rm "${IMAGE_TAG}" --print "process.versions.node" | ||
[ "$output" = "${NODE_VERSION}" ] | ||
} | ||
|
||
@test "Test for npm" { | ||
run docker run --rm "${IMAGE_TAG}" npm --version | ||
[ -n "$output" ] | ||
} | ||
|
||
@test "Test for yarn" { | ||
run docker run --rm "${IMAGE_TAG}" yarn --version | ||
[ -n "$output" ] | ||
} | ||
|
||
@test "Verify entrypoint runs regular, non-executable file with node" { | ||
run docker run --rm -v "${tmp_file}:/index.js" "${IMAGE_TAG}" index.js | ||
[ "$output" = 'success' ] | ||
} | ||
|
||
@test "Verify entrypoint runs regular, non-executable file inside subdirectory with node" { | ||
run docker run --rm -v "${tmp_file}:/app/index.js" "${IMAGE_TAG}" app/index.js | ||
[ "$output" = 'success' ] | ||
} |