Skip to content

Commit

Permalink
Merge pull request #250 from yinzara/feature/latest-updates
Browse files Browse the repository at this point in the history
Feature/latest updates - 3.1.0 release
  • Loading branch information
yinzara authored Mar 30, 2024
2 parents 8a71ffb + 1dba956 commit 69882ba
Show file tree
Hide file tree
Showing 11 changed files with 1,689 additions and 3,000 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[*]
root = true
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2
chaset = utf-8
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.ts]
indent_size = 4
10 changes: 5 additions & 5 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# then publish the resulting package to NPM js
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
branches: [ master ]

jobs:
build:
Expand All @@ -16,12 +16,12 @@ jobs:

strategy:
matrix:
node-version: [10.x, 12.x]
node-version: [16.x, 18.x, 20.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflow will do a clean install of node dependencies and publishes via npm
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js Publish CI

on:
pull_request:
types: [ closed ]
branches: [ master ]

jobs:
build:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: 'https://registry.npmjs.org'
- run: npm install
env:
CI: true
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_API_KEY }}
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jest-fetch-mock",
"version": "3.0.3",
"version": "3.1.0",
"description": "fetch mock for jest",
"main": "src/index.js",
"types": "types",
Expand All @@ -25,20 +25,20 @@
},
"homepage": "https://github.com/jefflau/jest-fetch-mock#readme",
"dependencies": {
"cross-fetch": "^3.1.5",
"domexception": "^2.0.1",
"promise-polyfill": "^8.1.3"
"cross-fetch": "^3.1.8",
"domexception": "^4.0.0",
"promise-polyfill": "^8.3.0"
},
"devDependencies": {
"@types/jest": "^26.0.14",
"@types/node": "^10.17.40",
"@typescript-eslint/eslint-plugin": "^4.5.0",
"@typescript-eslint/parser": "^4.5.0",
"eslint": "^7.11.0",
"jest": "^26.6.0",
"prettier": "^2.1.2",
"regenerator-runtime": "^0.13.7",
"typescript": "^4.0.3"
"@types/jest": "^29.5.12",
"@types/node": "^20.11.27",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"eslint": "^8.57.0",
"jest": "^29.7.0",
"prettier": "^3.2.5",
"regenerator-runtime": "^0.14.1",
"typescript": "^5.4.2"
},
"prettier": {
"semi": false,
Expand Down
2 changes: 1 addition & 1 deletion setupJest.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
global.fetch = require('jest-fetch-mock')
require('jest-fetch-mock').enableMocks()
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,5 @@ fetch.disableMocks = fetch.disableFetchMocks = () => {
}
}

Object.defineProperty(exports, '__esModule', { value: true })
module.exports = fetch.default = fetch
4 changes: 3 additions & 1 deletion tests/node.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/**
* @jest-environment node
*/
let DOMException = require('domexception')
if (typeof DOMException === 'undefined') {
DOMException = require('domexception')
}

it('rejects with a dom exception', () => {
fetch.mockAbort()
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "./types/tsconfig.json",
"compilerOptions": {
"target": "ES2015",
"baseUrl": ".",
"rootDir": "./types",
"paths": {
Expand All @@ -9,4 +10,4 @@
]
}
}
}
}
1 change: 1 addition & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// TypeScript Version: 3.0
/// <reference lib="dom" />
import Global = NodeJS.Global;
import "jest";

Expand Down
5 changes: 2 additions & 3 deletions types/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es2015",
"dom"
"es2015"
],
"baseUrl": ".",
"paths": {
Expand All @@ -18,4 +17,4 @@
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}
}
Loading

0 comments on commit 69882ba

Please sign in to comment.