Last active
July 31, 2019 21:23
-
-
Save mturley/a769bcc661f7208b876383cd087fcc86 to your computer and use it in GitHub Desktop.
Script for getting started with unit tests in a directory full of new JS code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
pwd | |
mkdir -p ./__tests__ | |
for file in * | |
do | |
if test -f "$file" && [[ $file == *.js ]] | |
then | |
testfile="./__tests__/${file/\.js/.test.js}" | |
if test -f "$testfile" | |
then | |
echo "File already exists: $testfile" | |
else | |
echo "Creating $testfile" | |
printf "// TODO\n\ntest.todo('unit tests for $file');\n" > $testfile | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment