Skip to content

Commit

Permalink
Ensure new Puppeteer download location is cached
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrotherham committed Oct 24, 2022
1 parent 95f7efa commit 8ad0084
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ concurrency:
group: tests-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
INSTALL_CACHE_DIR: |
.cache/puppeteer
node_modules
TASK_CACHE_DIR: |
.cache/eslint
.cache/jest
.cache/stylelint
jobs:
run-tests:
name: Run tests
Expand All @@ -28,16 +38,13 @@ jobs:
id: npm-cache
with:
key: npm-cache-${{ hashFiles('package-lock.json') }}
path: node_modules
path: ${{ env.INSTALL_CACHE_DIR }}

- name: Cache tasks
uses: actions/cache@v3
with:
key: task-cache
path: |
.cache/eslint
.cache/jest
.cache/stylelint
path: ${{ env.TASK_CACHE_DIR }}

- name: Setup Node.js
uses: actions/setup-node@v3
Expand Down
4 changes: 4 additions & 0 deletions jest-puppeteer.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
module.exports = {
browserContext: 'incognito',
browserPerWorker: true,

/**
* @type {import('puppeteer').PuppeteerLaunchOptions}
*/
launch: {
args: [
/**
Expand Down
8 changes: 8 additions & 0 deletions puppeteer.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { join } = require('path')

/**
* @type {import('puppeteer').Configuration}
*/
module.exports = {
cacheDirectory: join(__dirname, '.cache', 'puppeteer')
}

0 comments on commit 8ad0084

Please sign in to comment.