Chief. Windows
If you see this error:
Running unit tests:
: not foundtests.sh: 2: ./tests/runtests.sh:
./tests/runtests.sh: 4: ./tests/runtests.sh: Syntax error: word unexpected (expecting "do")
You have two options:
-
Open the file
tests/runtests.sh
in VS Code in whatever subproject folder you’re working in, e.g.fizzbuzz
. Click on the lower right of the screen where it saysCRLF
. ChooseLF
. Save the file. Then the error should go away. -
You can do this from the command line with the
tr
command:
cd tests
cat runtests.sh | tr -d '\r' > runtests.tmp
mv runtests.tmp runtests.sh
The root of the problem is a setting in git that causes all newlines (LF) to
be converted to carriage-return/newline (CRLF). The script runtests.sh
is a
bash script that bash runs, and bash hates \r
and pukes everywhere.
To cause git to not do newline conversion for future clones, run the following:
git config --global core.autocrlf false