From d52737a55bd84dedf7c91f02ebeb5e4b9d02b7c5 Mon Sep 17 00:00:00 2001 From: Isaac Good Date: Tue, 7 Jul 2026 23:31:35 -0700 Subject: [PATCH 1/3] Sync `run-in-docker.sh` from `generic-test-runner`; move `run-in-docker` scripts into `bin/` --- run-in-docker.bat => bin/run-in-docker.bat | 0 bin/run-in-docker.sh | 46 ++++++++++++++++++++++ 2 files changed, 46 insertions(+) rename run-in-docker.bat => bin/run-in-docker.bat (100%) create mode 100755 bin/run-in-docker.sh diff --git a/run-in-docker.bat b/bin/run-in-docker.bat similarity index 100% rename from run-in-docker.bat rename to bin/run-in-docker.bat diff --git a/bin/run-in-docker.sh b/bin/run-in-docker.sh new file mode 100755 index 0000000..f9e26a6 --- /dev/null +++ b/bin/run-in-docker.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env sh + +# Synopsis: +# Run the test runner on a solution using the test runner Docker image. +# The test runner Docker image is built automatically. + +# Arguments: +# $1: exercise slug +# $2: path to solution folder +# $3: path to output directory + +# Output: +# Writes the test results to a results.json file in the passed-in output directory. +# The test results are formatted according to the specifications at https://github.com/exercism/docs/blob/main/building/tooling/test-runners/interface.md + +# Example: +# ./bin/run-in-docker.sh two-fer path/to/solution/folder/ path/to/output/directory/ + +# Stop executing when a command returns a non-zero return code +set -e + +# If any required arguments is missing, print the usage and exit +if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then + echo "usage: ./bin/run-in-docker.sh exercise-slug path/to/solution/folder/ path/to/output/directory/" + exit 1 +fi + +slug="$1" +solution_dir=$(realpath "${2%/}") +output_dir=$(realpath "${3%/}") + +# Create the output directory if it doesn't exist +mkdir -p "${output_dir}" + +# Build the Docker image +docker build --rm -t exercism/typescript-test-runner . + +# Run the Docker image using the settings mimicking the production environment +docker run \ + --rm \ + --network none \ + --read-only \ + --mount type=bind,src="${solution_dir}",dst=/solution \ + --mount type=bind,src="${output_dir}",dst=/output \ + --mount type=tmpfs,dst=/tmp \ + exercism/typescript-test-runner "${slug}" /solution /output From abdfaad3cba6daad36cdc5d9f563801ecc8308ea Mon Sep 17 00:00:00 2001 From: Derk-Jan Karrenbeld Date: Thu, 6 Aug 2026 23:47:41 +0200 Subject: [PATCH 2/3] Apply suggestion from @kotp Co-authored-by: Victor Goff --- bin/run-in-docker.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/run-in-docker.sh b/bin/run-in-docker.sh index f9e26a6..30a70ab 100755 --- a/bin/run-in-docker.sh +++ b/bin/run-in-docker.sh @@ -11,7 +11,8 @@ # Output: # Writes the test results to a results.json file in the passed-in output directory. -# The test results are formatted according to the specifications at https://github.com/exercism/docs/blob/main/building/tooling/test-runners/interface.md +# The test results are formatted according to the specifications at +# https://github.com/exercism/docs/blob/main/building/tooling/test-runners/interface.md # Example: # ./bin/run-in-docker.sh two-fer path/to/solution/folder/ path/to/output/directory/ From 21614da5e245f479dfeacb28112c74ef7ec7e1a5 Mon Sep 17 00:00:00 2001 From: Isaac Good Date: Thu, 6 Aug 2026 16:35:58 -0700 Subject: [PATCH 3/3] Update `run-in-docker` path in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6d4bc1b..8e53b05 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ _This script is provided for testing purposes_ To run a solution's test in the Docker container, do the following: 1. Open terminal in project's root -2. Run `./run-in-docker.sh ` +2. Run `./bin/run-in-docker.sh ` ## Maintaining