Skip to content

Commit

Permalink
feat: moved tests to node:test (#628)
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurfiorette committed Sep 3, 2023
1 parent 8502c8e commit 2cc948d
Show file tree
Hide file tree
Showing 35 changed files with 965 additions and 2,738 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ node_modules
# Output
/dist
/dev
/test

# Random
/ignore
Expand Down
13 changes: 8 additions & 5 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Bug report
description: Create a report to help us improve
title: 'Bug:'
labels: ["bug", "triage"]
labels: ['bug', 'triage']
assignees: arthurfiorette

body:
Expand All @@ -15,7 +15,7 @@ body:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
value: "A bug happened!"
value: 'A bug happened!'
validations:
required: true
- type: input
Expand All @@ -31,7 +31,7 @@ body:
attributes:
label: Node / Browser Version
description: What version of Node.js / Browser are you running?
placeholder: Node v18.16.1 / Chrome 114
placeholder: Node v18.16.1 / Chrome 114
validations:
required: true
- type: input
Expand All @@ -46,7 +46,7 @@ body:
id: storage
attributes:
label: What storage is being used
description: What storage is being used?
description: What storage is being used?
options:
- Web Storage
- Memory Storage
Expand All @@ -58,7 +58,10 @@ body:
id: logs
attributes:
label: Relevant debugging log output
description: Please paste relevant log output collected from [debug mode](https://axios-cache-interceptor.js.org/guide/debugging). This will be automatically formatted into code, so no need for backticks.
description:
Please paste relevant log output collected from [debug
mode](https://axios-cache-interceptor.js.org/guide/debugging). This will be
automatically formatted into code, so no need for backticks.
render: js
validations:
required: true
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup node and restore cached dependencies
uses: actions/setup-node@v3
with:
node-version: '18'
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install packages
Expand All @@ -28,11 +28,11 @@ jobs:
- name: Lint
run: pnpm lint

- name: Test
run: pnpm test -- --ci
- name: Build tests
run: pnpm build:test

- name: Build
run: pnpm build
- name: Test
run: pnpm test

- name: ESCheck
run: pnpm run check
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Setup node and restore cached dependencies
uses: actions/setup-node@v3
with:
node-version: '18'
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install packages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup node and restore cached dependencies
uses: actions/setup-node@v3
with:
node-version: '18'
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install packages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup node and restore cached dependencies
uses: actions/setup-node@v3
with:
node-version: '18'
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org/'
cache: 'pnpm'

Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.5.0
15 changes: 7 additions & 8 deletions docs/src/guide/interceptors.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ axios.interceptors.response.use((res) => res);

## Extending types

When using axios-cache-interceptor, you'll note that it have a different type
than the defaults `AxiosInstance`, `AxiosRequestConfig` and `AxiosResponse`.
That's because was chosen to override axios's interfaces instead of extending,
to avoid breaking changes with other libraries.
When using axios-cache-interceptor, you'll note that it have a different type than the
defaults `AxiosInstance`, `AxiosRequestConfig` and `AxiosResponse`. That's because was
chosen to override axios's interfaces instead of extending, to avoid breaking changes with
other libraries.

However, this also means that when integrating with other packages or creating
your own custom interceptor, you need to override/extend our own types,
`CacheInstance`, `CacheRequestConfig` and `CacheAxiosResponse` to match your needs.
However, this also means that when integrating with other packages or creating your own
custom interceptor, you need to override/extend our own types, `CacheInstance`,
`CacheRequestConfig` and `CacheAxiosResponse` to match your needs.

This can be done as shown below:

Expand All @@ -59,4 +59,3 @@ declare module 'axios-cache-interceptor' {
}
}
```

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@
"scripts": {
"benchmark": "cd benchmark && pnpm start",
"build": "sh build/build.sh",
"build:test": "tsc -p tsconfig.test.json",
"check": "sh build/check.sh",
"docs:build": "vitepress build docs",
"docs:dev": "vitepress dev docs --port 1227",
"docs:serve": "vitepress serve docs",
"format": "prettier --write .",
"lint": "eslint . --ext .ts",
"test": "jest --verbose --coverage",
"test": "NODE_V8_COVERAGE=coverage node -r ./dist/test/setup.js --trace-warnings --experimental-test-coverage --test dist/test/**/*.test.js",
"version": "auto-changelog -p && cp CHANGELOG.md docs/src/others/changelog.md && git add CHANGELOG.md docs/src/others/changelog.md"
},
"resolutions": {
Expand All @@ -59,8 +60,8 @@
},
"devDependencies": {
"@arthurfiorette/prettier-config": "*",
"@types/jest": "^29.5.2",
"@types/node": "^18.16.16",
"@types/jsdom": "^21.1.2",
"@types/node": "^20.5.0",
"@types/webpack": "^5.28.1",
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.9",
Expand All @@ -70,12 +71,11 @@
"eslint": "^8.42.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"jsdom": "^22.1.0",
"prettier": "^2.8.8",
"prettier-plugin-jsdoc": "^0.4.2",
"prettier-plugin-organize-imports": "^3.2.2",
"ts-jest": "^29.1.0",
"source-map-support": "^0.5.21",
"ts-loader": "^9.4.3",
"tslib": "^2.5.3",
"typescript": "^5.1.3",
Expand Down

0 comments on commit 2cc948d

Please sign in to comment.