jest-webextension-mock 3.8.2 → 3.8.4

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.
@@ -7,26 +7,16 @@ name: Publish
7
7
 
8
8
  jobs:
9
9
  all:
10
- name: Publish
10
+ name: Merge-Release
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
- - uses: actions/checkout@v2
14
- - name: Get yarn cache directory path
15
- id: yarn-cache-dir-path
16
- run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
17
- - uses: actions/cache@v2
18
- id: yarn-cache
19
- with:
20
- path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
21
- key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
22
- restore-keys: ${{ runner.os }}-yarn-
23
- - name: Yarn Install
24
- run: yarn install
25
- - name: Yarn Test
26
- run: yarn test
27
- - name: Publish
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
28
19
  if: github.ref == 'refs/heads/main'
29
- uses: mikeal/merge-release@master
30
20
  env:
31
21
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32
22
  NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
@@ -15,20 +15,21 @@ jobs:
15
15
  node-version: [14.x, 16.x, 18.x]
16
16
 
17
17
  steps:
18
- - uses: actions/checkout@v2
19
- - name: Get yarn cache directory path
20
- id: yarn-cache-dir-path
21
- run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
22
- - uses: actions/cache@v2
23
- id: yarn-cache
18
+ - uses: actions/checkout@v3
24
19
  with:
25
- path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
26
- key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
27
- restore-keys: ${{ runner.os }}-yarn-
28
- - name: Use Node.js ${{ matrix.node-version }}
29
- uses: actions/setup-node@v1
20
+ fetch-depth: 2
21
+ - name: node.js ${{ matrix.node-version }}
22
+ uses: actions/setup-node@v3
30
23
  with:
31
24
  node-version: ${{ matrix.node-version }}
32
- - run: yarn install
33
- - run: yarn test
34
- - uses: codecov/codecov-action@v1
25
+ - run: npm ci
26
+ - run: npm test
27
+ - run: npm run build --if-present
28
+ - run: git status --porcelain dist/setup.js
29
+ - name: check dist build
30
+ run: |
31
+ if ! git diff --quiet --exit-code dist/setup.js; then
32
+ echo "::error run 'npm run build' and commit the dist/setup.js file"
33
+ exit 1
34
+ fi
35
+ - uses: codecov/codecov-action@v3
package/README.md CHANGED
@@ -2,17 +2,16 @@
2
2
 
3
3
  ## Install
4
4
 
5
-
6
- For yarn:
5
+ For npm:
7
6
 
8
7
  ```bash
9
- yarn add --dev jest-webextension-mock
8
+ npm i --save-dev jest-webextension-mock
10
9
  ```
11
10
 
12
- For npm:
11
+ For yarn:
13
12
 
14
13
  ```bash
15
- npm i --save-dev jest-webextension-mock
14
+ yarn add --dev jest-webextension-mock
16
15
  ```
17
16
 
18
17
  ## Setup
@@ -98,8 +97,8 @@ it('should toggle the profiler on from stopped', () => {
98
97
  ## Development
99
98
 
100
99
  ```
101
- yarn install
102
- yarn test
100
+ npm install
101
+ npm test
103
102
  ```
104
103
 
105
104
  ## Publish
package/dist/setup.js CHANGED
@@ -193,17 +193,11 @@ var tabs = {
193
193
  function _typeof(obj) {
194
194
  "@babel/helpers - typeof";
195
195
 
196
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
197
- _typeof = function (obj) {
198
- return typeof obj;
199
- };
200
- } else {
201
- _typeof = function (obj) {
202
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
203
- };
204
- }
205
-
206
- return _typeof(obj);
196
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
197
+ return typeof obj;
198
+ } : function (obj) {
199
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
200
+ }, _typeof(obj);
207
201
  }
208
202
 
209
203
  var store = {};
@@ -425,7 +419,7 @@ var commands = {
425
419
  }
426
420
  };
427
421
 
428
- var cbOrPromise = function cbOrPromise(cb, value) {
422
+ var cbOrPromise$1 = function cbOrPromise(cb, value) {
429
423
  if (cb !== undefined) {
430
424
  return cb(value);
431
425
  }
@@ -442,22 +436,22 @@ var create = function create(notificationId, options, cb) {
442
436
  cb = options;
443
437
  }
444
438
 
445
- return cbOrPromise(cb, notificationId);
439
+ return cbOrPromise$1(cb, notificationId);
446
440
  };
447
441
 
448
442
  var notifications = {
449
443
  create: jest.fn(create),
450
444
  update: jest.fn(function (notificationId, options, cb) {
451
- return cbOrPromise(cb, true);
445
+ return cbOrPromise$1(cb, true);
452
446
  }),
453
447
  clear: jest.fn(function (notificationId, cb) {
454
- return cbOrPromise(cb, true);
448
+ return cbOrPromise$1(cb, true);
455
449
  }),
456
450
  getAll: jest.fn(function (cb) {
457
- return cbOrPromise(cb, []);
451
+ return cbOrPromise$1(cb, []);
458
452
  }),
459
453
  getPermissionLevel: jest.fn(function (cb) {
460
- return cbOrPromise(cb, 'granted');
454
+ return cbOrPromise$1(cb, 'granted');
461
455
  }),
462
456
  onClosed: {
463
457
  addListener: jest.fn()
@@ -500,7 +494,7 @@ var extension = {
500
494
  getURL: jest.fn()
501
495
  };
502
496
 
503
- var cbOrPromise$1 = function cbOrPromise(cb, value) {
497
+ var cbOrPromise = function cbOrPromise(cb, value) {
504
498
  if (cb !== undefined) {
505
499
  return cb(value);
506
500
  }
@@ -510,32 +504,32 @@ var cbOrPromise$1 = function cbOrPromise(cb, value) {
510
504
 
511
505
  var downloads = {
512
506
  acceptDanger: jest.fn(function (downloadId, cb) {
513
- return cbOrPromise$1(cb);
507
+ return cbOrPromise(cb);
514
508
  }),
515
509
  cancel: jest.fn(function (downloadId, cb) {
516
- return cbOrPromise$1(cb);
510
+ return cbOrPromise(cb);
517
511
  }),
518
512
  download: jest.fn(function (options, cb) {
519
- return cbOrPromise$1(cb);
513
+ return cbOrPromise(cb);
520
514
  }),
521
515
  erase: jest.fn(function (query, cb) {
522
- return cbOrPromise$1(cb);
516
+ return cbOrPromise(cb);
523
517
  }),
524
518
  getFileIcon: jest.fn(function (downloadId, cb) {
525
- return cbOrPromise$1(cb);
519
+ return cbOrPromise(cb);
526
520
  }),
527
521
  open: jest.fn(),
528
522
  pause: jest.fn(function (downloadId, cb) {
529
- return cbOrPromise$1(cb);
523
+ return cbOrPromise(cb);
530
524
  }),
531
525
  removeFile: jest.fn(function (downloadId, cb) {
532
- return cbOrPromise$1(cb);
526
+ return cbOrPromise(cb);
533
527
  }),
534
528
  resume: jest.fn(function (downloadId, cb) {
535
- return cbOrPromise$1(cb);
529
+ return cbOrPromise(cb);
536
530
  }),
537
531
  search: jest.fn(function (query, cb) {
538
- return cbOrPromise$1(cb);
532
+ return cbOrPromise(cb);
539
533
  }),
540
534
  setShelfEnabled: jest.fn(),
541
535
  show: jest.fn(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jest-webextension-mock",
3
- "version": "3.8.2",
3
+ "version": "3.8.4",
4
4
  "description": "Mock the components of a WebExtension",
5
5
  "main": "dist/setup.js",
6
6
  "module": "src/setup.js",