Skip to content

mandric/extension-testing-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

extension-testing-example

Browser extension example attempting to provide a decent boilerplate for building web extensions with latest web development tools and practices. Including: ES Modules, testing with Mocha, Sinon and Selenium for e2e, and Webpack for bundling. Also testing in the browser to exercise the browser APIs available to extensions where possible.

webextension-polyfill is also used to standardize the browser API.

Goal is to have a decent code base that can target Chrome, Firefox and Safari.

Getting Started

git clone [this repo]
cd extension-testing-example
npm install
npm start

This should get you started developing, it will create a dist/development directory that you can load into your browser as an extension if you turn on extensions developer mode.

Webpack will also watch the source files and rebuild automatically.

Then you should be able to load the dist directory into your browser and see Fibonacci greatness.

See also Chrome: Getting Started Tutorial and Mozilla: Your First Extension for information about developing extensions.

Builds

Development builds include sourcemaps and tests:

npm run build # dist/development

Production/minimized build:

npm run build:prod # dist/production

Tests

npm test

You can also click the tests button in the extension popup to run the tests in a separate html page.

E2E tests:

npm run test:e2e

See package.json scripts property for more options.

Continuous Integration

Build artifacts (zip file of dist/) are being saved on CirlceCI but you might have to be logged in to see them.

CircleCI

Related Projects