Skip to content

Commit 53b1f2b

Browse files
Clean-up from PR 47 (#59)
1 parent 26e5dbc commit 53b1f2b

File tree

6 files changed

+71
-6
lines changed

6 files changed

+71
-6
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,8 @@ yarn-error.log
2626
/out
2727
/production_node_modules
2828
/package.template.json
29+
30+
# Fixture development files
31+
/test/fixtures/**/node_modules
32+
/test/fixtures/**/package-lock.json
33+
/test/fixtures/**/results.json

.prettierignore

+7
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,10 @@
88

99
/.yarn
1010
/.yarnrc.yml
11+
12+
# These are org-wide files (https://github.com/exercism/org-wide-files/)
13+
/.github/labels.yml
14+
/.github/workflows/sync-labels.yml
15+
16+
/CODE_OF_CONDUCT.md
17+
/LICENSE

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 4.0.0
4+
5+
- Add missing features from javascript-test-runner
6+
- Add proper corejs (and babel) support for mismatching solutions
7+
- Change implementation to support jest 29
8+
- Change package of `chalk` to lower major
9+
- Use Yarn 3
10+
311
## 3.0.0
412

513
- Rewritten for jest 17

bin/run.sh

+19-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ echo ""
104104
configuration_file="${INPUT}.meta/config.json"
105105
local_configuration_file="${INPUT}.exercism/config.json"
106106

107-
108107
# Prepare the test file(s)
109108
mkdir -p "${OUTPUT}"
110109

@@ -129,6 +128,17 @@ else
129128
fi;
130129
fi;
131130

131+
if test -d "${OUTPUT}node_modules"; then
132+
echo "Did not expect node_modules in output directory, but here we are"
133+
else
134+
ln -s "${ROOT}/node_modules" "${OUTPUT}node_modules"
135+
echo "Symlinked ${OUTPUT}node_modules (${ROOT}/node_modules)"
136+
fi;
137+
138+
# Rename babel.config.js and package.json
139+
mv "${OUTPUT}babel.config.js" "${OUTPUT}babel.config.js.__exercism.bak" || true
140+
mv "${OUTPUT}package.json" "${OUTPUT}package.json.__exercism.bak" || true
141+
132142
# Put together the path to the test results file
133143
result_file="${OUTPUT}results.json"
134144

@@ -163,6 +173,10 @@ if [ $test_exit -eq 2 ]
163173
then
164174
echo "tsc compilation failed"
165175

176+
# Restore babel.config.js and package.json
177+
mv "${OUTPUT}babel.config.js.__exercism.bak" "${OUTPUT}babel.config.js" || true
178+
mv "${OUTPUT}package.json.__exercism.bak" "${OUTPUT}package.json" || true
179+
166180
# Compose the message to show to the student
167181
#
168182
# TODO: interpret the tsc_result lines and pull out the source.
@@ -196,6 +210,10 @@ fi
196210
# Convert exit(1) (jest worked, but there are failing tests) to exit(0)
197211
test_exit=$?
198212

213+
# Restore babel.config.js and package.json
214+
mv "${OUTPUT}babel.config.js.__exercism.bak" "${OUTPUT}babel.config.js" || true
215+
mv "${OUTPUT}package.json.__exercism.bak" "${OUTPUT}package.json" || true
216+
199217
echo ""
200218
echo "Find the output at:"
201219
echo $result_file

run-in-docker.bat

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
@@ -0,0 +1,31 @@
2+
@REM Only works in bash for windows and similar terminals that accept / paths
3+
4+
@REM Synopsis:
5+
@REM Test runner for run.sh in a docker container
6+
@REM Takes the same arguments as run.sh (EXCEPT THAT SOLUTION AND OUTPUT PATH ARE RELATIVE)
7+
@REM Builds the Dockerfile
8+
@REM Runs the docker image passing along the initial arguments
9+
10+
@REM Arguments:
11+
@REM $1: exercise slug
12+
@REM $2: **RELATIVE** path to solution folder (without trailing slash)
13+
@REM $3: **RELATIVE** path to output directory (without trailing slash)
14+
15+
@REM Output:
16+
@REM Writes the tests output to the output directory
17+
18+
@REM Example:
19+
@REM ./run-in-docker.bat two-fer ./relative/path/to/two-fer/solution/folder/ ./relative/path/to/output-directory/
20+
@REM ./run-in-docker.bat two-fer ./test/fixtures/two-fer/pass ./test/fixtures/two-fer/pass
21+
22+
@REM build docker image
23+
docker build -t typescript-test-runner .
24+
25+
@REM run image passing the arguments
26+
docker run^
27+
--network none^
28+
--read-only^
29+
--mount type=bind,src=%cd%/%2,dst=/solution/^
30+
--mount type=bind,src=%cd%/%3,dst=/output/^
31+
--mount type=tmpfs,dst=/tmp^
32+
typescript-test-runner %1 /solution/ /output/

src/setup.ts

-5
This file was deleted.

0 commit comments

Comments
 (0)