Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

jest-webextension-mock

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-webextension-mock - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

.npmignore

2

package.json
{
"name": "jest-webextension-mock",
"version": "2.0.0",
"version": "2.0.1",
"description": "Mock the components of a WebExtension",

@@ -5,0 +5,0 @@ "main": "dist/setup.js",

@@ -0,1 +1,3 @@

[![npm](https://img.shields.io/npm/v/jest-webextension-mock.svg)](https://www.npmjs.com/package/jest-webextension-mock) | [![npm](https://img.shields.io/npm/l/jest-webextension-mock.svg)](https://github.com/clarkbw/jest-webextension-mock/blob/master/LICENSE) | [![Twitter](https://img.shields.io/twitter/url/https/github.com/clarkbw/jest-webextension-mock.svg?style=social)](https://twitter.com/intent/tweet?text=Wow:&url=%5Bobject%20Object%5D)
---|---

@@ -16,4 +18,6 @@ ## Install

## Usage
## Setup
### Require module directly
In your `package.json` under the `jest` section add the `setupFiles` attribute with this module name.

@@ -29,4 +33,6 @@

Alternatively you can create a setup file.
### Use setup file
Alternatively you can create a new setup file and require this module.
`__setups__/chrome.js`

@@ -47,2 +53,28 @@ ```js

## Usage
With this module setup in Jest you can start relying on it in your tests.
```js
describe('your function to test', () => {
it('should have called a webextension API', () => {
yourFunctionToTest();
expect(chrome.tabs.update).toHaveBeenCalled();
});
});
```
Check the API was called with certain parameters.
```js
describe('your function to test', () => {
it('should have called a webextension API', () => {
yourFunctionToTest();
expect(chrome.tabs.update).toHaveBeenCalledWith({
url: 'https://example.com/'
});
});
});
```
## Development

@@ -54,1 +86,19 @@

```
## Pull Request
Before every PR run the following:
```
yarn run prettier
```
## Publish
When publishing a new build, run the following:
```
yarn run prettier
yarn run build
yarn publish
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc