Skip to content

Commit b00eb5d

Browse files
dependabot[bot]nlf
andauthoredMar 22, 2022
chore: bump @npmcli/template-oss from 2.9.2 to 3.1.2 (#129)
* chore: bump @npmcli/template-oss from 2.9.2 to 3.1.2 Bumps [@npmcli/template-oss](https://github.com/npm/template-oss) from 2.9.2 to 3.1.2. - [Release notes](https://github.com/npm/template-oss/releases) - [Changelog](https://github.com/npm/template-oss/blob/main/CHANGELOG.md) - [Commits](npm/template-oss@v2.9.2...v3.1.2) --- updated-dependencies: - dependency-name: "@npmcli/template-oss" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * chore: postinstall for dependabot template-oss PR Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: nlf <quitlahok@gmail.com>
1 parent eb6e7b6 commit b00eb5d

17 files changed

+240
-175
lines changed
 

‎.commitlintrc.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
// This file is automatically added by @npmcli/template-oss. Do not edit.
1+
/* This file is automatically added by @npmcli/template-oss. Do not edit. */
22

33
module.exports = {
44
extends: ['@commitlint/config-conventional'],
5-
// If you change rules be sure to also update release-please.yml
65
rules: {
7-
'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'chore', 'deps']],
6+
'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'deps', 'chore']],
87
'header-max-length': [2, 'always', 80],
98
'subject-case': [0, 'always', ['lower-case', 'sentence-case', 'start-case']],
109
},

‎.eslintrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file is automatically added by @npmcli/template-oss. Do not edit.
1+
/* This file is automatically added by @npmcli/template-oss. Do not edit. */
22

33
const { readdirSync: readdir } = require('fs')
44

‎.github/CODEOWNERS

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
* @npm/cli-team
1+
# This file is automatically added by @npmcli/template-oss. Do not edit.
2+
3+
* @npm/cli-team

‎.github/ISSUE_TEMPLATE/bug.yml

+44-44
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,52 @@
33
name: Bug
44
description: File a bug/issue
55
title: "[BUG] <title>"
6-
labels: [Bug, Needs Triage]
6+
labels: [ Bug, Needs Triage ]
7+
78
body:
8-
- type: checkboxes
9-
attributes:
10-
label: Is there an existing issue for this?
11-
description: Please [search here](./issues) to see if an issue already exists for your problem.
12-
options:
13-
- label: I have searched the existing issues
14-
required: true
15-
- type: textarea
16-
attributes:
17-
label: Current Behavior
18-
description: A clear & concise description of what you're experiencing.
19-
validations:
20-
required: false
21-
- type: textarea
22-
attributes:
23-
label: Expected Behavior
24-
description: A clear & concise description of what you expected to happen.
25-
validations:
26-
required: false
27-
- type: textarea
28-
attributes:
29-
label: Steps To Reproduce
30-
description: Steps to reproduce the behavior.
31-
value: |
32-
1. In this environment...
33-
2. With this config...
34-
3. Run '...'
35-
4. See error...
36-
validations:
37-
required: false
38-
- type: textarea
39-
attributes:
40-
label: Environment
41-
description: |
42-
examples:
43-
- **npm**: 7.6.3
44-
- **Node**: 13.14.0
45-
- **OS**: Ubuntu 20.04
46-
- **platform**: Macbook Pro
47-
value: |
9+
- type: checkboxes
10+
attributes:
11+
label: Is there an existing issue for this?
12+
description: Please [search here](./issues) to see if an issue already exists for your problem.
13+
options:
14+
- label: I have searched the existing issues
15+
required: true
16+
- type: textarea
17+
attributes:
18+
label: Current Behavior
19+
description: A clear & concise description of what you're experiencing.
20+
validations:
21+
required: false
22+
- type: textarea
23+
attributes:
24+
label: Expected Behavior
25+
description: A clear & concise description of what you expected to happen.
26+
validations:
27+
required: false
28+
- type: textarea
29+
attributes:
30+
label: Steps To Reproduce
31+
description: Steps to reproduce the behavior.
32+
value: |
33+
1. In this environment...
34+
2. With this config...
35+
3. Run '...'
36+
4. See error...
37+
validations:
38+
required: false
39+
- type: textarea
40+
attributes:
41+
label: Environment
42+
description: |
43+
examples:
44+
- **npm**: 7.6.3
45+
- **Node**: 13.14.0
46+
- **OS**: Ubuntu 20.04
47+
- **platform**: Macbook Pro
48+
value: |
4849
- npm:
4950
- Node:
5051
- OS:
5152
- platform:
52-
validations:
53-
required: false
54-
53+
validations:
54+
required: false

‎.github/dependabot.yml

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
# This file is automatically added by @npmcli/template-oss. Do not edit.
22

33
version: 2
4+
45
updates:
5-
- package-ecosystem: npm
6-
directory: "/"
7-
schedule:
8-
interval: daily
9-
allow:
10-
- dependency-type: direct
11-
versioning-strategy: increase
12-
commit-message:
13-
prefix: deps
14-
prefix-development: chore
15-
labels:
16-
- "Dependencies"
6+
- package-ecosystem: npm
7+
directory: "/"
8+
schedule:
9+
interval: daily
10+
allow:
11+
- dependency-type: direct
12+
versioning-strategy: increase-if-necessary
13+
commit-message:
14+
prefix: deps
15+
prefix-development: chore
16+
labels:
17+
- "Dependencies"

‎.github/workflows/audit.yml

+13-9
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,25 @@
33
name: Audit
44

55
on:
6+
workflow_dispatch:
67
schedule:
78
# "At 01:00 on Monday" https://crontab.guru/#0_1_*_*_1
89
- cron: "0 1 * * 1"
9-
workflow_dispatch:
1010

1111
jobs:
1212
audit:
13-
name: npm audit
1413
runs-on: ubuntu-latest
1514
steps:
16-
- uses: actions/checkout@v2
17-
- uses: actions/setup-node@v2
15+
- uses: actions/checkout@v3
16+
- name: Setup git user
17+
run: |
18+
git config --global user.email "ops+npm-cli@npmjs.com"
19+
git config --global user.name "npm cli ops bot"
20+
- uses: actions/setup-node@v3
1821
with:
19-
node-version: '16'
20-
- name: Install deps
21-
run: npm i --package-lock
22-
- name: Audit
23-
run: npm audit
22+
node-version: 16.x
23+
- name: Update npm to latest
24+
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
25+
- run: npm -v
26+
- run: npm i --package-lock
27+
- run: npm audit

‎.github/workflows/ci.yml

+40-16
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
name: CI
44

55
on:
6+
workflow_dispatch:
67
pull_request:
8+
branches:
9+
- '*'
710
push:
811
branches:
912
- main
@@ -16,46 +19,67 @@ jobs:
1619
lint:
1720
runs-on: ubuntu-latest
1821
steps:
19-
- uses: actions/checkout@v2
20-
- uses: actions/setup-node@v2
22+
- uses: actions/checkout@v3
23+
- name: Setup git user
24+
run: |
25+
git config --global user.email "ops+npm-cli@npmjs.com"
26+
git config --global user.name "npm cli ops bot"
27+
- uses: actions/setup-node@v3
2128
with:
22-
node-version: '16'
23-
- run: npm i --prefer-online -g npm@latest
29+
node-version: 16.x
30+
- name: Update npm to latest
31+
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
32+
- run: npm -v
2433
- run: npm i
2534
- run: npm run lint
2635

2736
test:
2837
strategy:
2938
fail-fast: false
3039
matrix:
31-
node-version: [12.13.0, 12.x, 14.15.0, 14.x, 16.13.0, 16.x]
40+
node-version:
41+
- 12.13.0
42+
- 12.x
43+
- 14.15.0
44+
- 14.x
45+
- 16.0.0
46+
- 16.x
3247
platform:
33-
- os: ubuntu-latest
34-
shell: bash
35-
- os: macos-latest
36-
shell: bash
37-
- os: windows-latest
38-
shell: cmd
48+
- os: ubuntu-latest
49+
shell: bash
50+
- os: macos-latest
51+
shell: bash
52+
- os: windows-latest
53+
shell: cmd
3954
runs-on: ${{ matrix.platform.os }}
4055
defaults:
4156
run:
4257
shell: ${{ matrix.platform.shell }}
4358
steps:
44-
- uses: actions/checkout@v2
45-
- uses: actions/setup-node@v2
59+
- uses: actions/checkout@v3
60+
- name: Setup git user
61+
run: |
62+
git config --global user.email "ops+npm-cli@npmjs.com"
63+
git config --global user.name "npm cli ops bot"
64+
- uses: actions/setup-node@v3
4665
with:
4766
node-version: ${{ matrix.node-version }}
48-
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
4967
- name: Update to workable npm (windows)
50-
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12') || startsWith(matrix.node-version, '14'))
68+
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
69+
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.'))
5170
run: |
5271
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
5372
tar xf npm-7.5.4.tgz
5473
cd package
5574
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
5675
cd ..
5776
rmdir /s /q package
58-
- name: Update npm
77+
- name: Update npm to 7
78+
# If we do test on npm 10 it needs npm7
79+
if: startsWith(matrix.node-version, '10.')
80+
run: npm i --prefer-online --no-fund --no-audit -g npm@7
81+
- name: Update npm to latest
82+
if: ${{ !startsWith(matrix.node-version, '10.') }}
5983
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
6084
- run: npm -v
6185
- run: npm i

‎.github/workflows/codeql-analysis.yml

+18-12
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ name: "CodeQL"
44

55
on:
66
push:
7-
branches: [ main ]
7+
branches:
8+
- main
9+
- latest
810
pull_request:
911
# The branches below must be a subset of the branches above
10-
branches: [ main ]
12+
branches:
13+
- main
14+
- latest
1115
schedule:
1216
# "At 03:00 on Monday" https://crontab.guru/#0_3_*_*_1
1317
- cron: "0 3 * * 1"
@@ -24,15 +28,17 @@ jobs:
2428
strategy:
2529
fail-fast: false
2630
matrix:
27-
language: [ 'javascript' ]
31+
language: [ javascript ]
2832

2933
steps:
30-
- name: Checkout repository
31-
uses: actions/checkout@v2
32-
33-
- name: Initialize CodeQL
34-
uses: github/codeql-action/init@v1
35-
with:
36-
languages: ${{ matrix.language }}
37-
- name: Perform CodeQL Analysis
38-
uses: github/codeql-action/analyze@v1
34+
- uses: actions/checkout@v3
35+
- name: Setup git user
36+
run: |
37+
git config --global user.email "ops+npm-cli@npmjs.com"
38+
git config --global user.name "npm cli ops bot"
39+
- name: Initialize CodeQL
40+
uses: github/codeql-action/init@v1
41+
with:
42+
languages: ${{ matrix.language }}
43+
- name: Perform CodeQL Analysis
44+
uses: github/codeql-action/analyze@v1

‎.github/workflows/post-dependabot.yml

+17-9
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,43 @@
11
# This file is automatically added by @npmcli/template-oss. Do not edit.
22

3-
name: "Post Dependabot Actions"
3+
name: Post Dependabot Actions
4+
45
on: pull_request
56

67
# https://docs.github.com/en/rest/overview/permissions-required-for-github-apps
78
permissions:
9+
actions: write
810
contents: write
911

1012
jobs:
1113
Install:
1214
runs-on: ubuntu-latest
13-
if: ${{ github.actor == 'dependabot[bot]' }}
15+
if: github.actor == 'dependabot[bot]'
1416
steps:
15-
- uses: actions/checkout@v2
16-
- uses: actions/setup-node@v2
17+
- uses: actions/checkout@v3
18+
- name: Setup git user
19+
run: |
20+
git config --global user.email "ops+npm-cli@npmjs.com"
21+
git config --global user.name "npm cli ops bot"
22+
- uses: actions/setup-node@v3
1723
with:
18-
node-version: '16'
24+
node-version: 16.x
25+
- name: Update npm to latest
26+
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
27+
- run: npm -v
1928
- name: Dependabot metadata
2029
id: metadata
2130
uses: dependabot/fetch-metadata@v1.1.1
2231
with:
2332
github-token: "${{ secrets.GITHUB_TOKEN }}"
2433
- name: npm install and commit
25-
if: ${{contains(steps.metadata.outputs.dependency-names, '@npmcli/template-oss')}}
34+
if: contains(steps.metadata.outputs.dependency-names, '@npmcli/template-oss')
2635
env:
2736
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2837
run: |
29-
git config --local user.email "ops+npm-cli@npmjs.com"
30-
git config --local user.name "npm cli ops bot"
3138
gh pr checkout ${{ github.event.pull_request.number }}
32-
npm install
39+
npm install --no-scripts
40+
npm run template-oss-apply
3341
git add .
3442
git commit -am "chore: postinstall for dependabot template-oss PR"
3543
git push

‎.github/workflows/pull-request.yml

+18-7
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,35 @@ name: Pull Request Linting
44

55
on:
66
pull_request:
7-
types: [opened, reopened, edited, synchronize]
7+
types:
8+
- opened
9+
- reopened
10+
- edited
11+
- synchronize
812

913
jobs:
1014
check:
1115
name: Check PR Title or Commits
1216
runs-on: ubuntu-latest
1317
steps:
14-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v3
1519
with:
1620
fetch-depth: 0
17-
- uses: actions/setup-node@v2
21+
- name: Setup git user
22+
run: |
23+
git config --global user.email "ops+npm-cli@npmjs.com"
24+
git config --global user.name "npm cli ops bot"
25+
- uses: actions/setup-node@v3
1826
with:
19-
node-version: '16'
27+
node-version: 16.x
28+
- name: Update npm to latest
29+
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
30+
- run: npm -v
2031
- name: Install deps
21-
run: |
22-
npm i -D @commitlint/cli @commitlint/config-conventional
32+
run: npm i -D @commitlint/cli @commitlint/config-conventional
2333
- name: Check commits OR PR title
2434
env:
2535
PR_TITLE: ${{ github.event.pull_request.title }}
2636
run: |
27-
npx commitlint -x @commitlint/config-conventional -V --from origin/main --to ${{ github.event.pull_request.head.sha }} || echo $PR_TITLE | npx commitlint -x @commitlint/config-conventional -V
37+
npx --offline commitlint -V --from origin/main --to ${{ github.event.pull_request.head.sha }} \
38+
|| echo $PR_TITLE | npx --offline commitlint -V

‎.github/workflows/release-please.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@ on:
66
push:
77
branches:
88
- main
9+
- latest
910

1011
jobs:
1112
release-please:
1213
runs-on: ubuntu-latest
1314
steps:
14-
- uses: google-github-actions/release-please-action@v2
15+
- uses: google-github-actions/release-please-action@v3
1516
id: release
1617
with:
1718
release-type: node
18-
# If you change changelog-types be sure to also update commitlintrc.js
1919
changelog-types: >
20-
[{"type":"feat","section":"Features","hidden":false},
21-
{"type":"fix","section":"Bug Fixes","hidden":false},
22-
{"type":"docs","section":"Documentation","hidden":false},
23-
{"type":"deps","section":"Dependencies","hidden":false},
24-
{"type":"chore","hidden":true}]
20+
[
21+
{"type":"feat","section":"Features","hidden":false},
22+
{"type":"fix","section":"Bug Fixes","hidden":false},
23+
{"type":"docs","section":"Documentation","hidden":false},
24+
{"type":"deps","section":"Dependencies","hidden":false},
25+
{"type":"chore","hidden":true}
26+
]

‎.gitignore

+14-12
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@
44
/*
55

66
# keep these
7-
!/.commitlintrc.js
8-
!/.npmrc
9-
!/.eslintrc*
10-
!/.github
7+
!/.eslintrc.local.*
118
!**/.gitignore
12-
!/package.json
13-
!/docs
14-
!/bin
15-
!/lib
9+
!/docs/
10+
!/tap-snapshots/
11+
!/test/
1612
!/map.js
17-
!/tap-snapshots
18-
!/test
19-
!/scripts
13+
!/scripts/
2014
!/README*
2115
!/LICENSE*
22-
!/SECURITY*
2316
!/CHANGELOG*
17+
!/.commitlintrc.js
18+
!/.eslintrc.js
19+
!/.github/
20+
!/.gitignore
21+
!/.npmrc
22+
!/SECURITY.md
23+
!/bin/
24+
!/lib/
25+
!/package.json

‎.npmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
;This file is automatically added by @npmcli/template-oss. Do not edit.
1+
; This file is automatically added by @npmcli/template-oss. Do not edit.
22

33
package-lock=false

‎lib/cache/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ const cacheFetch = async (request, options) => {
1414

1515
// otherwise, we make a request, store it and return it
1616
const response = await remote(request, options)
17-
const entry = new CacheEntry({ request, response, options })
18-
return entry.store('miss')
17+
const newEntry = new CacheEntry({ request, response, options })
18+
return newEntry.store('miss')
1919
}
2020

2121
// we have a cached response that satisfies this request, however if the cache

‎package.json

+14-10
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"description": "Opinionated, caching, retrying fetch client",
55
"main": "lib/index.js",
66
"files": [
7-
"bin",
8-
"lib"
7+
"bin/",
8+
"lib/"
99
],
1010
"scripts": {
1111
"preversion": "npm test",
@@ -14,13 +14,16 @@
1414
"test": "tap",
1515
"posttest": "npm run lint",
1616
"eslint": "eslint",
17-
"lint": "eslint '**/*.js'",
17+
"lint": "eslint \"**/*.js\"",
1818
"lintfix": "npm run lint -- --fix",
19-
"postlint": "npm-template-check",
19+
"postlint": "template-oss-check",
2020
"snap": "tap",
21-
"template-copy": "npm-template-copy --force"
21+
"template-oss-apply": "template-oss-apply --force"
22+
},
23+
"repository": {
24+
"type": "git",
25+
"url": "https://github.com/npm/make-fetch-happen.git"
2226
},
23-
"repository": "https://github.com/npm/make-fetch-happen",
2427
"keywords": [
2528
"http",
2629
"request",
@@ -51,8 +54,8 @@
5154
"ssri": "^8.0.1"
5255
},
5356
"devDependencies": {
54-
"@npmcli/template-oss": "^2.9.2",
55-
"eslint": "^8.11.0",
57+
"@npmcli/eslint-config": "^3.0.1",
58+
"@npmcli/template-oss": "3.1.2",
5659
"mkdirp": "^1.0.4",
5760
"nock": "^13.2.4",
5861
"rimraf": "^3.0.2",
@@ -61,14 +64,15 @@
6164
"tap": "^15.1.6"
6265
},
6366
"engines": {
64-
"node": "^12.13.0 || ^14.15.0 || >=16"
67+
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
6568
},
6669
"tap": {
6770
"color": 1,
6871
"files": "test/*.js",
6972
"check-coverage": true
7073
},
7174
"templateOSS": {
72-
"version": "2.9.2"
75+
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
76+
"version": "3.1.2"
7377
}
7478
}

‎test/agent.js

+29-27
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ t.test('get proxy uri', async t => {
181181

182182
t.test('get proxy agent', async t => {
183183
const { getProxy } = agent
184-
const OPTS = {
184+
const PROXY_OPTS = {
185185
ca: 'ca',
186186
cert: 'cert',
187187
keyu: 'key',
@@ -191,7 +191,7 @@ t.test('get proxy agent', async t => {
191191
rejectUnauthorized: true,
192192
}
193193

194-
t.strictSame(getProxy(new url.URL('http://proxy.local:443/'), OPTS, true), {
194+
t.strictSame(getProxy(new url.URL('http://proxy.local:443/'), PROXY_OPTS, true), {
195195
host: 'proxy.local',
196196
port: '443',
197197
protocol: 'http:',
@@ -207,7 +207,7 @@ t.test('get proxy agent', async t => {
207207
__type: 'https-proxy',
208208
}, 'http proxy url, for https request')
209209

210-
t.strictSame(getProxy(new url.URL('https://proxy.local:443/'), OPTS, true), {
210+
t.strictSame(getProxy(new url.URL('https://proxy.local:443/'), PROXY_OPTS, true), {
211211
host: 'proxy.local',
212212
port: '',
213213
protocol: 'https:',
@@ -223,7 +223,7 @@ t.test('get proxy agent', async t => {
223223
__type: 'https-proxy',
224224
}, 'https proxy url, for https request')
225225

226-
t.strictSame(getProxy(new url.URL('socks://proxy.local:443/'), OPTS, true), {
226+
t.strictSame(getProxy(new url.URL('socks://proxy.local:443/'), PROXY_OPTS, true), {
227227
host: 'proxy.local',
228228
port: '443',
229229
protocol: 'socks:',
@@ -239,7 +239,7 @@ t.test('get proxy agent', async t => {
239239
__type: 'socks-proxy',
240240
}, 'socks proxy url, for https request')
241241

242-
t.strictSame(getProxy(new url.URL('http://proxy.local:443/'), OPTS, false), {
242+
t.strictSame(getProxy(new url.URL('http://proxy.local:443/'), PROXY_OPTS, false), {
243243
host: 'proxy.local',
244244
port: '443',
245245
protocol: 'http:',
@@ -255,7 +255,7 @@ t.test('get proxy agent', async t => {
255255
__type: 'http-proxy',
256256
}, 'http proxy url, for http request')
257257

258-
t.strictSame(getProxy(new url.URL('https://proxy.local:443/'), OPTS, false), {
258+
t.strictSame(getProxy(new url.URL('https://proxy.local:443/'), PROXY_OPTS, false), {
259259
host: 'proxy.local',
260260
port: '',
261261
protocol: 'https:',
@@ -271,7 +271,7 @@ t.test('get proxy agent', async t => {
271271
__type: 'http-proxy',
272272
}, 'https proxy url, for http request')
273273

274-
t.strictSame(getProxy(new url.URL('socks://proxy.local:443/'), OPTS, false), {
274+
t.strictSame(getProxy(new url.URL('socks://proxy.local:443/'), PROXY_OPTS, false), {
275275
host: 'proxy.local',
276276
port: '443',
277277
protocol: 'socks:',
@@ -287,7 +287,7 @@ t.test('get proxy agent', async t => {
287287
__type: 'socks-proxy',
288288
}, 'socks proxy url, for http request')
289289

290-
t.strictSame(getProxy(new url.URL('http://user:pass@proxy.local:443/'), OPTS, false), {
290+
t.strictSame(getProxy(new url.URL('http://user:pass@proxy.local:443/'), PROXY_OPTS, false), {
291291
host: 'proxy.local',
292292
port: '443',
293293
protocol: 'http:',
@@ -303,7 +303,7 @@ t.test('get proxy agent', async t => {
303303
__type: 'http-proxy',
304304
}, 'http proxy url, for http request')
305305

306-
t.strictSame(getProxy(new url.URL('http://user@proxy.local:443/'), OPTS, false), {
306+
t.strictSame(getProxy(new url.URL('http://user@proxy.local:443/'), PROXY_OPTS, false), {
307307
host: 'proxy.local',
308308
port: '443',
309309
protocol: 'http:',
@@ -319,7 +319,7 @@ t.test('get proxy agent', async t => {
319319
__type: 'http-proxy',
320320
}, 'http proxy url, for http request')
321321

322-
t.strictSame(getProxy(new url.URL('http://user%231:pass@proxy.local:443/'), OPTS, false), {
322+
t.strictSame(getProxy(new url.URL('http://user%231:pass@proxy.local:443/'), PROXY_OPTS, false), {
323323
host: 'proxy.local',
324324
port: '443',
325325
protocol: 'http:',
@@ -335,23 +335,25 @@ t.test('get proxy agent', async t => {
335335
__type: 'http-proxy',
336336
}, 'http proxy url, for http request')
337337

338-
t.strictSame(getProxy(new url.URL('http://user%231:pass%231@proxy.local:443/'), OPTS, false), {
339-
host: 'proxy.local',
340-
port: '443',
341-
protocol: 'http:',
342-
path: '/',
343-
auth: 'user#1:pass#1',
344-
ca: 'ca',
345-
cert: 'cert',
346-
key: undefined,
347-
timeout: 2,
348-
localAddress: 'local address',
349-
maxSockets: 3,
350-
rejectUnauthorized: true,
351-
__type: 'http-proxy',
352-
}, 'http proxy url, for http request')
353-
354-
t.throws(() => getProxy(new url.URL('gopher://proxy.local'), OPTS, false), {
338+
t.strictSame(
339+
getProxy(new url.URL('http://user%231:pass%231@proxy.local:443/'), PROXY_OPTS, false),
340+
{
341+
host: 'proxy.local',
342+
port: '443',
343+
protocol: 'http:',
344+
path: '/',
345+
auth: 'user#1:pass#1',
346+
ca: 'ca',
347+
cert: 'cert',
348+
key: undefined,
349+
timeout: 2,
350+
localAddress: 'local address',
351+
maxSockets: 3,
352+
rejectUnauthorized: true,
353+
__type: 'http-proxy',
354+
}, 'http proxy url, for http request')
355+
356+
t.throws(() => getProxy(new url.URL('gopher://proxy.local'), PROXY_OPTS, false), {
355357
message: 'unsupported proxy protocol: \'gopher:\'',
356358
code: 'EUNSUPPORTEDPROXY',
357359
url: 'gopher://proxy.local',

‎test/fetch.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ t.test('calls opts.onRetry', async t => {
8787
retry: {
8888
retries: 1,
8989
},
90-
onRetry: (res) => {
90+
onRetry: () => {
9191
calledOnRetry = true
9292
retryNotification++
9393
},
@@ -236,7 +236,7 @@ t.test('supports redirect logic', async t => {
236236
.get('/redirect')
237237
.reply(301)
238238

239-
const err = await fetch(`${HOST}/redirect`).catch(err => err)
239+
const err = await fetch(`${HOST}/redirect`).catch(reqErr => reqErr)
240240
t.type(err, FetchError)
241241
t.equal(err.code, 'EINVALIDREDIRECT')
242242
t.ok(srv.isDone())

0 commit comments

Comments
 (0)
Please sign in to comment.