Skip to content

Commit

Permalink
Log more things
Browse files Browse the repository at this point in the history
  • Loading branch information
SleeplessByte committed Aug 11, 2024
1 parent c794d3f commit 6fb51d4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
12 changes: 8 additions & 4 deletions bin/run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env sh

# Synopsis:
# Test the test runner by running it against a predefined set of solutions
# Test the test runner by running it against a predefined set of solutions
# with an expected output.

# Output:
Expand All @@ -14,7 +14,7 @@
exit_code=0

# We need to copy the fixtures to a temp directory as the user
# running within the Docker container does not have permissions
# running within the Docker container does not have permissions
# to run the sed command on the fixtures directory
fixtures_dir="test/fixtures"
tmp_fixtures_dir="/tmp/test/fixtures"
Expand All @@ -24,6 +24,8 @@ cp -R ${fixtures_dir}/* "${tmp_fixtures_dir}"

# Iterate over all test directories
for test_file in $(find "${tmp_fixtures_dir}" -name '*.spec.js'); do
echo "πŸ‘οΈ ${test_file}"

slug=$(echo "${test_file:${#tmp_fixtures_dir}+1}" | cut -d / -f 1)
test_dir=$(dirname "${test_file}")
test_dir_name=$(basename "${test_dir}")
Expand All @@ -36,8 +38,10 @@ for test_file in $(find "${tmp_fixtures_dir}" -name '*.spec.js'); do

bin/run.sh "${slug}" "${test_dir_path}" "${test_dir_path}"

echo "${slug}/${test_dir_name}: comparing results.json to expected_results.json"
diff "${results_file_path}" "${expected_results_file_path}"
if test -f $expected_results_file_path; then
echo "${slug}/${test_dir_name}: comparing results.json to expected_results.json"
diff "${results_file_path}" "${expected_results_file_path}"
fi;

if [ $? -ne 0 ]; then
exit_code=1
Expand Down
15 changes: 6 additions & 9 deletions bin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,15 @@ echo " πŸ”§ Process input arguments for run "
echo "β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•"
echo ""

echo "βœ”οΈ Using slug : $SLUG"
echo "βœ”οΈ Using reporter : $REPORTER"
echo "βœ”οΈ Using test-root: $INPUT"
echo "βœ”οΈ Using base-root: $ROOT"
echo "βœ”οΈ Using setup-env: $SETUP"

if test -f "$REPORTER"; then
echo "βœ”οΈ Using reporter : $REPORTER"
echo "βœ”οΈ Using test-root: $INPUT"
echo "βœ”οΈ Using base-root: $ROOT"
echo "βœ”οΈ Using setup-env: $SETUP"
echo "βœ”οΈ reporter.js found, test runner was built"
else
echo "βœ”οΈ Using reporter : $REPORTER"
echo "βœ”οΈ Using test-root: $INPUT"
echo "βœ”οΈ Using base-root: $ROOT"
echo "βœ”οΈ Using setup-env: $SETUP"

>&2 echo "❌ Expected reporter.js to exist."
>&2 echo "❌ Did you forget to 'corepack pnpm build' first?"
>&2 echo ""
Expand Down

0 comments on commit 6fb51d4

Please sign in to comment.