diff --git a/examples.md b/examples.md index 1f6ecef..68f6be7 100644 --- a/examples.md +++ b/examples.md @@ -19,6 +19,7 @@ - [Node - Lerna](#node---lerna) - [Node - Yarn](#node---yarn) - [Node - Yarn 2](#node---yarn-2) +- [Node - Jest](#node---jest) - [OCaml/Reason - esy](#ocamlreason---esy) - [PHP - Composer](#php---composer) - [Python - pip](#python---pip) @@ -295,6 +296,24 @@ The yarn 2 cache directory will depend on your config. See https://yarnpkg.com/c ${{ runner.os }}-yarn- ``` +## Node - Jest +The Jest cache directory will depend on your config. See https://jestjs.io/docs/cli#--cache for more info. + +```yaml +- name: Get Jest cache directory path + id: jest-cache-dir-path + run: | + JEST_CACHE_DIR=$(yarn jest --showConfig | grep -o '"cacheDirectory": "[^"]*' | grep -o '[^"]*$') + echo "::set-output name=dir::$JEST_CACHE_DIR" + +- uses: actions/cache@v2 + with: + path: ${{ steps.jest-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-jest-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-jest- +``` + ## OCaml/Reason - esy Esy allows you to export built dependencies and import pre-built dependencies.