jest-webextension-mock 3.8.11 → 3.8.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  [![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) [![Codecov](https://img.shields.io/codecov/c/github/clarkbw/jest-webextension-mock.svg)](https://codecov.io/gh/clarkbw/jest-webextension-mock) [![Greenkeeper badge](https://badges.greenkeeper.io/clarkbw/jest-webextension-mock.svg)](https://greenkeeper.io/) [![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)
2
2
 
3
- 💪 @RickyMarou is an official maintainer. This change was made on `2024-04-12` as @clarkbw has not been able to devote sufficient time necessary for this project.
4
-
5
3
  ## Install
6
4
 
7
5
  For npm:
@@ -102,10 +100,3 @@ it('should toggle the profiler on from stopped', () => {
102
100
  npm install
103
101
  npm test
104
102
  ```
105
-
106
- ## Publish
107
-
108
- Publishing new releases is automated via the GitHub Action https://github.com/mikeal/merge-release tool.
109
-
110
- To ensure your feature is properly released prefix your commit message with `feat` for any new feature. For example: `feat: new API` and this will bump the minor release number. All other changes will be assumed as patch releases unless you include the string `BREAKING CHANGE` in your commit message or description which will trigger a new major release. (do not do this unless absolutely required)
111
-
@@ -102,6 +102,22 @@ describe('browser.tabs', () => {
102
102
  expect(browser.tabs.onUpdated[method]).toHaveBeenCalledTimes(1);
103
103
  expect(callback).toHaveBeenCalledTimes(0);
104
104
  });
105
+
106
+ test(`onRemoved.${method}`, () => {
107
+ const callback = jest.fn();
108
+ expect(jest.isMockFunction(browser.tabs.onRemoved[method])).toBe(true);
109
+ browser.tabs.onRemoved[method](callback);
110
+ expect(browser.tabs.onRemoved[method]).toHaveBeenCalledTimes(1);
111
+ expect(callback).toHaveBeenCalledTimes(0);
112
+ });
113
+
114
+ test(`onCreated.${method}`, () => {
115
+ const callback = jest.fn();
116
+ expect(jest.isMockFunction(browser.tabs.onCreated[method])).toBe(true);
117
+ browser.tabs.onCreated[method](callback);
118
+ expect(browser.tabs.onCreated[method]).toHaveBeenCalledTimes(1);
119
+ expect(callback).toHaveBeenCalledTimes(0);
120
+ });
105
121
  });
106
122
  test('reload', (done) => {
107
123
  const callback = jest.fn(() => done());
package/dist/setup.js CHANGED
@@ -215,6 +215,16 @@ var tabs = {
215
215
  removeListener: jest.fn(),
216
216
  hasListener: jest.fn()
217
217
  },
218
+ onRemoved: {
219
+ addListener: jest.fn(),
220
+ removeListener: jest.fn(),
221
+ hasListener: jest.fn()
222
+ },
223
+ onCreated: {
224
+ addListener: jest.fn(),
225
+ removeListener: jest.fn(),
226
+ hasListener: jest.fn()
227
+ },
218
228
  sendMessage: jest.fn(function (tabId, message, cb) {
219
229
  onMessageListeners.forEach(function (listener) {
220
230
  return listener(tabId, message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jest-webextension-mock",
3
- "version": "3.8.11",
3
+ "version": "3.8.12",
4
4
  "description": "Mock the components of a WebExtension",
5
5
  "main": "dist/setup.js",
6
6
  "module": "src/setup.js",
@@ -13,6 +13,7 @@
13
13
  "scripts": {
14
14
  "test": "jest",
15
15
  "build": "rollup -c",
16
+ "release": "bumpp && npm publish",
16
17
  "prettier": "prettier --write \"{config,src,__{tests,setups}__}/**/*.js\" rollup.config.js",
17
18
  "eslint-check": "eslint --print-config .eslintrc.js | eslint-config-prettier-check"
18
19
  },
@@ -21,6 +22,7 @@
21
22
  "@babel/preset-env": "^7.11.5",
22
23
  "babel-core": "^7.0.0-bridge.0",
23
24
  "babel-jest": "^26.5.2",
25
+ "bumpp": "^9.4.0",
24
26
  "eslint": "^7.11.0",
25
27
  "eslint-config-prettier": "^6.12.0",
26
28
  "eslint-plugin-prettier": "^3.1.4",
@@ -44,6 +46,5 @@
44
46
  "setupFiles": [
45
47
  "./__setups__/chrome.js"
46
48
  ]
47
- },
48
- "dependencies": {}
49
+ }
49
50
  }
package/src/tabs.js CHANGED
@@ -45,6 +45,16 @@ export const tabs = {
45
45
  removeListener: jest.fn(),
46
46
  hasListener: jest.fn(),
47
47
  },
48
+ onRemoved: {
49
+ addListener: jest.fn(),
50
+ removeListener: jest.fn(),
51
+ hasListener: jest.fn(),
52
+ },
53
+ onCreated: {
54
+ addListener: jest.fn(),
55
+ removeListener: jest.fn(),
56
+ hasListener: jest.fn(),
57
+ },
48
58
  sendMessage: jest.fn((tabId, message, cb) => {
49
59
  onMessageListeners.forEach((listener) => listener(tabId, message));
50
60
  if (cb !== undefined) {
@@ -1,22 +0,0 @@
1
- on:
2
- push:
3
- branches:
4
- - main
5
-
6
- name: Publish
7
-
8
- jobs:
9
- all:
10
- name: Merge-Release
11
- runs-on: ubuntu-latest
12
- steps:
13
- - uses: actions/checkout@v3
14
- - run: npm ci
15
- - run: npm test
16
- - run: npm run build --if-present
17
- - run: git status --porcelain dist/setup.js
18
- - uses: mikeal/merge-release@master
19
- if: github.ref == 'refs/heads/main'
20
- env:
21
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22
- NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}