Skip to content

Commit

Permalink
fix: fix download progress & use abort(reason) for timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
molvqingtai committed Oct 7, 2023
1 parent d0d4816 commit d6cef88
Show file tree
Hide file tree
Showing 6 changed files with 2,276 additions and 2,116 deletions.
6 changes: 0 additions & 6 deletions __tests__/hooks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ describe('Test hooks', () => {
})

const res = await resreq.request({ url: '/api' })
// TODO fix callback execution time
await sleep(1000)
expect(progressInfo).toEqual([
[{ ratio: 0, carry: 0, total: 0 }, ''],
[{ ratio: 50, carry: 3, total: 6 }, 'foo'],
Expand Down Expand Up @@ -56,8 +54,6 @@ describe('Test hooks', () => {
progressInfo.push([progress, new TextDecoder().decode(chunk)])
}
})
// TODO fix callback execution time
await sleep(1000)
expect(progressInfo).toEqual([
[{ ratio: 0, carry: 0, total: 0 }, ''],
[{ ratio: 50, carry: 3, total: 6 }, 'foo'],
Expand Down Expand Up @@ -90,8 +86,6 @@ describe('Test hooks', () => {
url: '/api',
onDownloadProgress: () => localProgressCallback()
})
// TODO fix callback execution time
await sleep(1000)
expect(globalProgressCallback).toBeCalledTimes(2)
expect(localProgressCallback).toBeCalledTimes(2)

Expand Down
55 changes: 28 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,40 +49,41 @@
},
"homepage": "https://github.com/molvqingtai/resreq#readme",
"devDependencies": {
"@commitlint/cli": "^17.4.4",
"@commitlint/config-conventional": "^17.4.4",
"@commitlint/cli": "^17.7.2",
"@commitlint/config-conventional": "^17.7.0",
"@koa/cors": "^4.0.0",
"@koa/router": "^12.0.0",
"@semantic-release/changelog": "^6.0.2",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@types/koa": "^2.13.5",
"@types/koa__cors": "^3.3.1",
"@types/koa__router": "^12.0.0",
"@types/node": "^18.15.0",
"@typescript-eslint/eslint-plugin": "^5.54.1",
"@typescript-eslint/parser": "^5.54.1",
"@vitest/coverage-c8": "^0.29.2",
"@vitest/ui": "^0.29.2",
"c8": "^7.13.0",
"eslint": "^8.35.0",
"eslint-config-prettier": "^8.7.0",
"eslint-config-standard": "^17.0.0",
"eslint-config-standard-with-typescript": "^34.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.6.1",
"@types/koa": "^2.13.9",
"@types/koa__cors": "^4.0.1",
"@types/koa__router": "^12.0.1",
"@types/node": "^20.8.3",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"@vitest/coverage-c8": "^0.33.0",
"@vitest/coverage-v8": "^0.34.6",
"@vitest/ui": "^0.34.6",
"c8": "^8.0.1",
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard": "^17.1.0",
"eslint-config-standard-with-typescript": "^39.1.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-n": "^16.1.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-promise": "^6.1.1",
"husky": "^8.0.3",
"koa": "^2.14.1",
"koa": "^2.14.2",
"koa-body": "^6.0.1",
"prettier": "^2.8.4",
"semantic-release": "^20.1.1",
"tsup": "^6.6.3",
"typedoc": "^0.23.26",
"typescript": "^4.9.5",
"vite": "^4.1.4",
"vitest": "^0.29.2"
"prettier": "^3.0.3",
"semantic-release": "^22.0.5",
"tsup": "^7.2.0",
"typedoc": "^0.25.1",
"typescript": "^5.2.2",
"vite": "^4.4.11",
"vitest": "^0.34.6"
},
"publishConfig": {
"access": "public"
Expand Down
Loading

0 comments on commit d6cef88

Please sign in to comment.