Skip to content

Commit

Permalink
fix(deps): update dependency axios to v1 (#613)
Browse files Browse the repository at this point in the history
* fix(deps): update dependency axios to v1

* Use new adapter setting

See axios/axios#5277

* Fix tests

* Remove unnecessary transform

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Brendan Mulholland <brendan@recital.software>
  • Loading branch information
renovate[bot] and Brendan Mulholland committed Oct 4, 2023
1 parent d52fd2d commit 2a13750
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 18 deletions.
19 changes: 19 additions & 0 deletions jest.config.js
@@ -0,0 +1,19 @@
const config = {
"preset": "ts-jest/presets/js-with-ts",
"setupFiles": [
"<rootDir>/src/__helpers__/setupEnvVars.js"
],
"testEnvironment": "jsdom",
"coverageThreshold": {
"global": {
"lines": 90
}
},
"moduleNameMapper": {
// Force CommonJS build for http adapter to be available.
// via https://github.com/axios/axios/issues/5101#issuecomment-1276572468
'^axios$': require.resolve('axios'),
},
}

module.exports = config;
14 changes: 1 addition & 13 deletions package.json
Expand Up @@ -48,18 +48,6 @@
"url": "https://github.com/manosim/gitify/issues"
},
"homepage": "https://www.gitify.io/",
"jest": {
"preset": "ts-jest/presets/js-with-ts",
"setupFiles": [
"<rootDir>/src/__helpers__/setupEnvVars.js"
],
"testEnvironment": "jsdom",
"coverageThreshold": {
"global": {
"lines": 90
}
}
},
"build": {
"appId": "com.electron.gitify",
"productName": "Gitify",
Expand Down Expand Up @@ -106,7 +94,7 @@
},
"dependencies": {
"@primer/octicons-react": "19.8.0",
"axios": "0.27.2",
"axios": "1.5.1",
"date-fns": "2.30.0",
"electron-updater": "6.1.4",
"final-form": "4.20.10",
Expand Down
13 changes: 9 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/hooks/useNotifications.test.ts
Expand Up @@ -9,7 +9,9 @@ import { mockedUser } from '../__mocks__/mockedData';

describe('hooks/useNotifications.ts', () => {
beforeEach(() => {
axios.defaults.adapter = require('axios/lib/adapters/http');
// axios will default to using the XHR adapter which can't be intercepted
// by nock. So, configure axios to use the node adapter.
axios.defaults.adapter = 'http';
});

describe('fetchNotifications', () => {
Expand Down

0 comments on commit 2a13750

Please sign in to comment.