Skip to content

Commit 69882ba

Browse files
authoredMar 30, 2024··
Merge pull request #250 from yinzara/feature/latest-updates
Feature/latest updates - 3.1.0 release
2 parents 8a71ffb + 1dba956 commit 69882ba

11 files changed

+1689
-3000
lines changed
 

‎.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[*]
2+
root = true
3+
end_of_line = lf
4+
insert_final_newline = true
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
chaset = utf-8
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.ts]
15+
indent_size = 4

‎.github/workflows/nodejs.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# then publish the resulting package to NPM js
23
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
34

45
name: Node.js CI
56

67
on:
78
push:
8-
branches: [ master ]
99
pull_request:
10-
branches: [ master ]
10+
branches: [ master ]
1111

1212
jobs:
1313
build:
@@ -16,12 +16,12 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
node-version: [10.x, 12.x]
19+
node-version: [16.x, 18.x, 20.x]
2020

2121
steps:
22-
- uses: actions/checkout@v2
22+
- uses: actions/checkout@v4
2323
- name: Use Node.js ${{ matrix.node-version }}
24-
uses: actions/setup-node@v1
24+
uses: actions/setup-node@v4
2525
with:
2626
node-version: ${{ matrix.node-version }}
2727
- run: npm install

‎.github/workflows/publish.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This workflow will do a clean install of node dependencies and publishes via npm
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Node.js Publish CI
5+
6+
on:
7+
pull_request:
8+
types: [ closed ]
9+
branches: [ master ]
10+
11+
jobs:
12+
build:
13+
if: github.event.pull_request.merged == true
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 20.x
22+
registry-url: 'https://registry.npmjs.org'
23+
- run: npm install
24+
env:
25+
CI: true
26+
- run: npm publish
27+
env:
28+
NODE_AUTH_TOKEN: ${{ secrets.NPM_API_KEY }}

‎package.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jest-fetch-mock",
3-
"version": "3.0.3",
3+
"version": "3.1.0",
44
"description": "fetch mock for jest",
55
"main": "src/index.js",
66
"types": "types",
@@ -25,20 +25,20 @@
2525
},
2626
"homepage": "https://github.com/jefflau/jest-fetch-mock#readme",
2727
"dependencies": {
28-
"cross-fetch": "^3.1.5",
29-
"domexception": "^2.0.1",
30-
"promise-polyfill": "^8.1.3"
28+
"cross-fetch": "^3.1.8",
29+
"domexception": "^4.0.0",
30+
"promise-polyfill": "^8.3.0"
3131
},
3232
"devDependencies": {
33-
"@types/jest": "^26.0.14",
34-
"@types/node": "^10.17.40",
35-
"@typescript-eslint/eslint-plugin": "^4.5.0",
36-
"@typescript-eslint/parser": "^4.5.0",
37-
"eslint": "^7.11.0",
38-
"jest": "^26.6.0",
39-
"prettier": "^2.1.2",
40-
"regenerator-runtime": "^0.13.7",
41-
"typescript": "^4.0.3"
33+
"@types/jest": "^29.5.12",
34+
"@types/node": "^20.11.27",
35+
"@typescript-eslint/eslint-plugin": "^7.2.0",
36+
"@typescript-eslint/parser": "^7.2.0",
37+
"eslint": "^8.57.0",
38+
"jest": "^29.7.0",
39+
"prettier": "^3.2.5",
40+
"regenerator-runtime": "^0.14.1",
41+
"typescript": "^5.4.2"
4242
},
4343
"prettier": {
4444
"semi": false,

‎setupJest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
global.fetch = require('jest-fetch-mock')
1+
require('jest-fetch-mock').enableMocks()

‎src/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -273,4 +273,5 @@ fetch.disableMocks = fetch.disableFetchMocks = () => {
273273
}
274274
}
275275

276+
Object.defineProperty(exports, '__esModule', { value: true })
276277
module.exports = fetch.default = fetch

‎tests/node.test.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/**
22
* @jest-environment node
33
*/
4-
let DOMException = require('domexception')
4+
if (typeof DOMException === 'undefined') {
5+
DOMException = require('domexception')
6+
}
57

68
it('rejects with a dom exception', () => {
79
fetch.mockAbort()

‎tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extends": "./types/tsconfig.json",
33
"compilerOptions": {
4+
"target": "ES2015",
45
"baseUrl": ".",
56
"rootDir": "./types",
67
"paths": {
@@ -9,4 +10,4 @@
910
]
1011
}
1112
}
12-
}
13+
}

‎types/index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// TypeScript Version: 3.0
2+
/// <reference lib="dom" />
23
import Global = NodeJS.Global;
34
import "jest";
45

‎types/tsconfig.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
"compilerOptions": {
33
"module": "commonjs",
44
"lib": [
5-
"es2015",
6-
"dom"
5+
"es2015"
76
],
87
"baseUrl": ".",
98
"paths": {
@@ -18,4 +17,4 @@
1817
"noEmit": true,
1918
"forceConsistentCasingInFileNames": true
2019
}
21-
}
20+
}

‎yarn.lock

+1,618-2,976
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.