Skip to content

Instantly share code, notes, and snippets.

@AshCoolman
Created February 1, 2018 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AshCoolman/5a55f5e5f9c25bd0f1ec3b51a65a15d1 to your computer and use it in GitHub Desktop.
Save AshCoolman/5a55f5e5f9c25bd0f1ec3b51a65a15d1 to your computer and use it in GitHub Desktop.
Lerna repo test finder
# Easy to use mocha globs to find test files in this structure:
#
# └─src
# │ └─index.spec.js
# └─.dist
# │ └─index.spec.js
# └─node_modules
# └─(...various...)
#
# With this structure, it got very difficult with include+exclude globs (perhaps impossible)
#
# └─src
# │ └─index.spec.js
# └─.dist
# │ └─index.spec.js
# └─node_modules
# │ └─(...various...)
# └─packages
# └─name
# └─src
# └─.dist
# └─node_modules
# └─(...various...)
#
# Thus I just used this shell script to get full control, that will pretty readable (for shell)
#
# Works with:
# - Whatever bash is on Ubuntu 16.04
# - GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17)
find . \
\( -name '*.spec.js' -o -name '*.spec.jsx' \) \
-and \
\( \
\( -not -path "*node_modules*" \) \
-and \
\( -not -path "*.dist*" \) \
\)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment