Skip to content

Instantly share code, notes, and snippets.

@EnixCoda
Last active June 8, 2023 05:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EnixCoda/3603317935816cd25af35a45f1792bbd to your computer and use it in GitHub Desktop.
Save EnixCoda/3603317935816cd25af35a45f1792bbd to your computer and use it in GitHub Desktop.
Test local Chrome extensions with Jest and Puppeteer
// 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}`
],
},
}
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