Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM node:20-bookworm-slim AS runner
# Node.js 20 (curently LTS)
FROM node:22-bookworm-slim AS runner
# Node.js 22 (curently LTS)
# Debian bookwork

# fetch latest security updates
Expand All @@ -9,20 +9,20 @@ RUN set -ex; \
# curl is required to fetch our webhook from github
# unzip is required for unzipping payloads in development
apt-get install curl unzip jq -y; \
rm -rf /var/lib/apt/lists/*

# add a non-root user to run our code as
RUN adduser --disabled-password --gecos "" appuser
rm -rf /var/lib/apt/lists/*; \
#
# add a non-root user to run our code as
adduser --disabled-password --gecos "" appuser; \
mkdir /somewhere/.cache/node/corepack/v1 -p; \
chmod 555 /somewhere/.cache/node/corepack/v1; \
chown -R appuser /somewhere/.cache/node;

# install our test runner to /opt
WORKDIR /opt/test-runner
COPY . .

# Install pnpm so it will be available read-only
# https://github.com/nodejs/corepack/issues/183#issue-1379672431
# https://github.com/nodejs/corepack/blob/bc13d40037d0b1bfd386e260ae741f55505b5c7c/tests/main.test.ts#L483
RUN mkdir -p /idk/corepack
ENV COREPACK_HOME=/idk/corepack
ENV COREPACK_HOME=/somewhere/.cache/node \
COREPACK_DEFAULT_TO_LATEST=0;

RUN set -ex; \
corepack enable pnpm; \
Expand All @@ -35,23 +35,23 @@ RUN set -ex; \
#
# https://github.com/nodejs/corepack/issues/414#issuecomment-2096218732
# https://github.com/nodejs/corepack/blob/bc13d40037d0b1bfd386e260ae741f55505b5c7c/sources/folderUtils.ts#L26-L31
chmod 444 /idk/corepack/lastKnownGood.json; \
chmod 555 /idk/corepack;

# Build the test runner
RUN set -ex; \
# chmod 444 /somewhere/.cache/node/corepack/lastKnownGood.json; \
# chmod 555 /somewhere/.cache/node/corepack/corepack; \
#
# Build the test runner
# RUN set -ex; \
# install all the development modules (used for building)
# corepack pnpm store prune; \
corepack pnpm install; \
corepack pnpm build; \
corepack pnpm prune --prod;

# Disable network for corepack
ENV COREPACK_ENABLE_NETWORK=0
ENV COREPACK_ENABLE_STRICT=0

# Mark this as a docker run so we don't try to execute things in /tmp
ENV TMP_MAY_BE_NON_EXEC=1
ENV COREPACK_ENABLE_NETWORK=0 \
COREPACK_ENABLE_STRICT=0 \
#
# Mark this as a docker run so we don't try to execute things in /tmp
TMP_MAY_BE_NON_EXEC=1;

# Execute everything as the appuser
USER appuser
Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is only used by jest.runner.config.js, when running the
// test-runner. The tool itself uses typescript's compilation instead.
module.exports = {
presets: [['@exercism/babel-preset-javascript', { corejs: '3.38' }]],
presets: [['@exercism/babel-preset-javascript', { corejs: '3.44' }]],
plugins: [],
}
8 changes: 6 additions & 2 deletions bin/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,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}"

echo "::group::Testing 👁️ ${test_file}"

slug=$(basename "${test_file}" | sed s/.spec.js$//)
test_dir=$(dirname "${test_file}")
Expand All @@ -43,14 +44,17 @@ for test_file in $(find "${tmp_fixtures_dir}" -name '*.spec.js'); do
bin/run.sh "${slug}" "${test_dir_path}" "${test_dir_path}"

if test -f $expected_results_file_path; then
echo "${slug}/${test_dir_name}: comparing results.json to expected_results.json"
touch "${results_file_path}" # ensure it exists
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
echo "diff \"${results_file_path}\" \"${expected_results_file_path}\" reported $?"
exit_code=1
fi

echo "::endgroup::"
done

exit ${exit_code}
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@exercism/javascript-test-runner",
"description": "Automated Test runner for exercism solutions in Javascript.",
"author": "Derk-Jan Karrenbeld <derk-jan+github@karrenbeld.info>",
"version": "5.0.0",
"version": "6.0.0",
"license": "AGPL-3.0-or-later",
"repository": {
"type": "git",
Expand All @@ -27,30 +27,30 @@
"test:bare": "corepack pnpm node test/smoke.test.mjs && corepack pnpm node test/skip.test.mjs && corepack pnpm node test/log.test.mjs && corepack pnpm node test/taskid.test.mjs"
},
"dependencies": {
"@exercism/babel-preset-javascript": "^0.5.0",
"@exercism/babel-preset-javascript": "^0.6.0",
"@exercism/static-analysis": "^0.14.0",
"@jest/console": "^29.7.0",
"@jest/reporters": "^29.7.0",
"@jest/test-result": "^29.7.0",
"@jest/types": "^29.6.3",
"@typescript-eslint/typescript-estree": "^8.0.1",
"@typescript-eslint/visitor-keys": "^8.0.1",
"@typescript-eslint/typescript-estree": "^8.37.0",
"@typescript-eslint/visitor-keys": "^8.37.0",
"babel-jest": "^29.7.0",
"chalk": "^5.3.0",
"core-js": "^3.38.0",
"chalk": "^5.4.1",
"core-js": "^3.44.0",
"jest": "^29.7.0",
"shelljs": "^0.10.0"
},
"devDependencies": {
"@exercism/eslint-config-tooling": "^0.6.0",
"@exercism/eslint-config-tooling": "^0.9.0",
"@jest/globals": "^29.7.0",
"@tsconfig/node20": "^20.1.4",
"@types/node": "^22.1.0",
"@types/shelljs": "^0.8.15",
"eslint": "^9.8.0",
"prettier": "^3.3.3",
"@tsconfig/node22": "^22.0.2",
"@types/node": "^22.16.5",
"@types/shelljs": "^0.8.17",
"eslint": "^9.31.0",
"prettier": "^3.6.2",
"rimraf": "^6.0.1",
"typescript": "~5.8.3"
"typescript": "~5.7.3"
},
"packageManager": "pnpm@9.7.0+sha512.dc09430156b427f5ecfc79888899e1c39d2d690f004be70e05230b72cb173d96839587545d09429b55ac3c429c801b4dc3c0e002f653830a420fa2dd4e3cf9cf"
"packageManager": "pnpm@10.13.1+sha512.37ebf1a5c7a30d5fabe0c5df44ee8da4c965ca0c5af3dbab28c3a1681b70a256218d05c81c9c0dcf767ef6b8551eb5b960042b9ed4300c59242336377e01cfad"
}
Loading