1- # ` @bumble/ jest-chrome`
1+ # ` jest-chrome `
22
33A complete mock of the Chrome API for Chrome extensions, for use
44with Jest.
55
6- The ` chrome ` object is based on schemas from the Chromium
7- project, with thanks to
8- [ ` sinon-chrome ` ] ( https://github.com/acvetkov/sinon-chrome ) for
9- compiling the schemas.
10-
116TypeScript support is built in. Each function and event is based
12- on
13- [ ` @types/chrome ` ] ( https://www.npmjs.com/package/@types/chrome ) .
7+ on the
8+ [ ` @types/chrome ` ] ( https://www.npmjs.com/package/@types/chrome )
9+ package.
1410
1511## Installation
1612
1713``` sh
18- npm i @bumble/ jest-chrome -D
14+ npm i jest-chrome -D
1915```
2016
2117Set ` chrome ` in the global scope during setup so that it is
@@ -36,14 +32,14 @@ Use the setup file to assign the mocked `chrome` object to the
3632``` javascript
3733// jest.setup.js
3834
39- Object .assign (global , require (' @bumble/ jest-chrome' ))
35+ Object .assign (global , require (' jest-chrome' ))
4036```
4137
42- Import ` chrome ` from ` @bumble/ jest-chrome` for Intellisense and
43- linting. This is the same object as ` chrome ` in the global scope.
38+ Import ` chrome ` from ` jest-chrome ` for Intellisense and linting.
39+ This is the same object as ` chrome ` in the global scope.
4440
4541``` javascript
46- import { chrome } from ' @bumble/ jest-chrome'
42+ import { chrome } from ' jest-chrome'
4743```
4844
4945## Usage
@@ -201,3 +197,13 @@ test('chrome api functions with lastError', () => {
201197 expect (chrome .runtime .lastError ).toBeUndefined ()
202198})
203199```
200+
201+ ### Contributions
202+
203+ The ` chrome ` object is based on schemas from the Chromium
204+ project, with thanks to
205+ [ ` sinon-chrome ` ] ( https://github.com/acvetkov/sinon-chrome ) for
206+ compiling the schemas.
207+
208+ Special thanks to [ @shellscape ] ( https://github.com/shellscape )
209+ for transferring the NPM package name ` jest-chrome ` to us!
0 commit comments