Skip to content

Commit

Permalink
Merge pull request #4 from bumble-org:migrate-to-extend-chrome
Browse files Browse the repository at this point in the history
Closes #3
  • Loading branch information
jacksteamdev committed Jun 10, 2020
2 parents ed5fbdb + 37f5e64 commit 3545913
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# **Change Log** 📜📝

All notable changes to "**@bumble/jest-chrome**" library will be
All notable changes to "**jest-chrome**" library will be
documented in this file.

The format is based on
Expand Down
32 changes: 19 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
# `@bumble/jest-chrome`
# `jest-chrome`

A complete mock of the Chrome API for Chrome extensions, for use
with Jest.

The `chrome` object is based on schemas from the Chromium
project, with thanks to
[`sinon-chrome`](https://github.com/acvetkov/sinon-chrome) for
compiling the schemas.

TypeScript support is built in. Each function and event is based
on
[`@types/chrome`](https://www.npmjs.com/package/@types/chrome).
on the
[`@types/chrome`](https://www.npmjs.com/package/@types/chrome)
package.

## Installation

```sh
npm i @bumble/jest-chrome -D
npm i jest-chrome -D
```

Set `chrome` in the global scope during setup so that it is
Expand All @@ -36,14 +32,14 @@ Use the setup file to assign the mocked `chrome` object to the
```javascript
// jest.setup.js

Object.assign(global, require('@bumble/jest-chrome'))
Object.assign(global, require('jest-chrome'))
```

Import `chrome` from `@bumble/jest-chrome` for Intellisense and
linting. This is the same object as `chrome` in the global scope.
Import `chrome` from `jest-chrome` for Intellisense and linting.
This is the same object as `chrome` in the global scope.

```javascript
import { chrome } from '@bumble/jest-chrome'
import { chrome } from 'jest-chrome'
```

## Usage
Expand Down Expand Up @@ -201,3 +197,13 @@ test('chrome api functions with lastError', () => {
expect(chrome.runtime.lastError).toBeUndefined()
})
```

### Contributions

The `chrome` object is based on schemas from the Chromium
project, with thanks to
[`sinon-chrome`](https://github.com/acvetkov/sinon-chrome) for
compiling the schemas.

Special thanks to [@shellscape](https://github.com/shellscape)
for transferring the NPM package name `jest-chrome` to us!
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@bumble/jest-chrome",
"name": "jest-chrome",
"version": "0.5.3",
"description": "Test Chrome extensions with Jest. A complete mock of the Chrome API.",
"keywords": [
Expand All @@ -12,7 +12,8 @@
"test",
"typescript"
],
"repository": "bumble-org/jest-chrome",
"repository": "github:extend-chrome/jest-chrome",
"bugs": "https://github.com/extend-chrome/jest-chrome/issues",
"license": "MIT",
"author": "Jack Steam <jacksteamdev@gmail.com>",
"main": "lib/index.cjs.js",
Expand Down

0 comments on commit 3545913

Please sign in to comment.