Last active
June 8, 2023 05:21
-
-
Save EnixCoda/3603317935816cd25af35a45f1792bbd to your computer and use it in GitHub Desktop.
Test local Chrome extensions with Jest and Puppeteer
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
// install dependencies first: | |
// $ yarn add jest jest-puppeteer puppeteer -D | |
const path = require('path') | |
const CRX_PATH = path.resolve(__dirname, 'path/to/local/extension/dir') | |
module.exports = { | |
launch: { | |
headless: false, // required for loading extensions | |
args: [ | |
`--disable-extensions-except=${CRX_PATH}`, | |
`--load-extension=${CRX_PATH}` | |
], | |
}, | |
} |
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
module.exports = { | |
preset: 'jest-puppeteer', | |
// Note: no testEnvironment | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment