Last active
June 6, 2020 02:05
-
-
Save wesleylhandy/3d3d931f19c00c79528ef40e89c814d3 to your computer and use it in GitHub Desktop.
MacOS Bash Command to Create (empty) Test Files for any JavaScript or TypeScript files in your project.
This file contains 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
#!/bin/bash | |
find . \( -iname "*.js*" -or -iname "*.ts*" \) \ | |
-and \( ! -path "*/__mocks__/*" ! -name "*.test.*" ! -name "*.spec.*" \) \ | |
-exec sh -c \ | |
'b=$(basename $1);f=${b%.*};d=$(dirname $1);e=${b##*.}; mkdir -p $d/__tests__ && > $d/__tests__/$f.test.$e' \ | |
sh {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
bash
starts Bash,sh
depends on some settings.