Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: CI

on:
push:
branches: [master]
pull_request:

jobs:
test:
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: yarn
# yarn 1 does not expand env vars in .npmrc and does not attach credentials to
# scope-routed registries, so write the token AND make npm.goodeggs.com (which
# proxies npmjs) the default registry at runtime. Later npmrc lines win.
- run: |
echo "registry=https://npm.goodeggs.com" >> .npmrc
echo "always-auth=true" >> .npmrc
echo "//npm.goodeggs.com/:_authToken=${NPM_TOKEN}" >> .npmrc
- run: yarn install --frozen-lockfile
- run: yarn test
33 changes: 33 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish

on:
push:
tags:
- 'v*'

jobs:
publish:
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: yarn
registry-url: https://registry.npmjs.org
# yarn 1 does not expand env vars in .npmrc and does not attach credentials to
# scope-routed registries, so write the token AND make npm.goodeggs.com (which
# proxies npmjs) the default registry at runtime. Later npmrc lines win.
# NPM_TOKEN reads @goodeggs packages from npm.goodeggs.com during install;
# NPMJS_PUBLISH_TOKEN publishes this package to the public npmjs registry
# (npm publish targets publishConfig.registry, not the default registry).
- run: |
echo "registry=https://npm.goodeggs.com" >> .npmrc
echo "always-auth=true" >> .npmrc
echo "//npm.goodeggs.com/:_authToken=${NPM_TOKEN}" >> .npmrc
- run: yarn install --frozen-lockfile
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_PUBLISH_TOKEN }}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
registry = https://registry.npmjs.org/
@goodeggs:registry=https://npm.goodeggs.com/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"goodeggs-test-helpers": "^8.3.2",
"leasot": "^13.3.0",
"mocha": "10.5.2",
"nock": "13.5.4",
"nock": "^14",
"nyc": "^15.1.0",
"typescript": "^4.3.5"
},
Expand Down
4 changes: 2 additions & 2 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('jsonFetch', () => {
expect(response.headers).to.be.ok();
});
it('resolves with JSON body when content-type contains other values but includes application/json', async () => {
nock('http://www.test.com').get('/products/1234').reply(204, '[{}]', {
nock('http://www.test.com').get('/products/1234').reply(200, '[{}]', {
'Content-Type': 'application/json; charset=utf-8',
});
const response = await jsonFetch('http://www.test.com/products/1234');
Expand Down Expand Up @@ -569,7 +569,7 @@ describe('jsonFetch', () => {
try {
await jsonFetch('http://www.test.com/products/1234');
} catch (err) {
expect(err.message).to.contain('Unexpected string');
expect(err.message).to.contain('in JSON at position 16');
return;
}

Expand Down
55 changes: 50 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1640,6 +1640,18 @@
"@jridgewell/resolve-uri" "^3.0.3"
"@jridgewell/sourcemap-codec" "^1.4.10"

"@mswjs/interceptors@^0.41.0":
version "0.41.9"
resolved "https://registry.yarnpkg.com/@mswjs/interceptors/-/interceptors-0.41.9.tgz#9d90bbd60d1ddc30dbcbb827a9bb2e470493530d"
integrity sha512-VVPPgHyQ6ShqnrmDWuxjmUIsO9gWyOZFmuOfLd9LfBGQJwZfy0gvv9pbHSJuoFNIYC7ZDX9aoFwowjcdSC4E8w==
dependencies:
"@open-draft/deferred-promise" "^2.2.0"
"@open-draft/logger" "^0.3.0"
"@open-draft/until" "^2.0.0"
is-node-process "^1.2.0"
outvariant "^1.4.3"
strict-event-emitter "^0.5.1"

"@nicolo-ribaudo/chokidar-2@2.1.8-no-fsevents.3":
version "2.1.8-no-fsevents.3"
resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz#323d72dd25103d0c4fbdce89dadf574a787b1f9b"
Expand Down Expand Up @@ -1668,6 +1680,24 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"

"@open-draft/deferred-promise@^2.2.0":
version "2.2.0"
resolved "https://registry.yarnpkg.com/@open-draft/deferred-promise/-/deferred-promise-2.2.0.tgz#4a822d10f6f0e316be4d67b4d4f8c9a124b073bd"
integrity sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA==

"@open-draft/logger@^0.3.0":
version "0.3.0"
resolved "https://registry.yarnpkg.com/@open-draft/logger/-/logger-0.3.0.tgz#2b3ab1242b360aa0adb28b85f5d7da1c133a0954"
integrity sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ==
dependencies:
is-node-process "^1.2.0"
outvariant "^1.4.0"

"@open-draft/until@^2.0.0":
version "2.1.0"
resolved "https://registry.yarnpkg.com/@open-draft/until/-/until-2.1.0.tgz#0acf32f470af2ceaf47f095cdecd40d68666efda"
integrity sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg==

"@sinonjs/commons@^1.6.0", "@sinonjs/commons@^1.7.0", "@sinonjs/commons@^1.8.1":
version "1.8.3"
resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.3.tgz#3802ddd21a50a949b6721ddd72da36e67e7f1b2d"
Expand Down Expand Up @@ -3639,6 +3669,11 @@ is-negative-zero@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.2.tgz#7bf6f03a28003b8b3965de3ac26f664d765f3150"

is-node-process@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/is-node-process/-/is-node-process-1.2.0.tgz#ea02a1b90ddb3934a19aea414e88edef7e11d134"
integrity sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw==

is-number-object@^1.0.4:
version "1.0.5"
resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.5.tgz#6edfaeed7950cff19afedce9fbfca9ee6dd289eb"
Expand Down Expand Up @@ -4200,12 +4235,12 @@ nise@^5.0.1:
just-extend "^4.0.2"
path-to-regexp "^1.7.0"

nock@13.5.4:
version "13.5.4"
resolved "https://registry.yarnpkg.com/nock/-/nock-13.5.4.tgz#8918f0addc70a63736170fef7106a9721e0dc479"
integrity sha512-yAyTfdeNJGGBFxWdzSKCBYxs5FxLbCg5X5Q4ets974hcQzG1+qCxvIyOo4j2Ry6MUlhWVMX4OoYDefAIIwupjw==
nock@^14:
version "14.0.16"
resolved "https://registry.yarnpkg.com/nock/-/nock-14.0.16.tgz#d92dcc85ecf704791ef0bacb2447f81ea5ec52f4"
integrity sha512-8r4KEc6nT1D/fdLD/R1BO1CPaVEL8o40u/guFRJlXabN7vr3RmMqyjsY5Krt0nMwhsOAwXQ/mtN5vy5Jh3aErg==
dependencies:
debug "^4.1.0"
"@mswjs/interceptors" "^0.41.0"
json-stringify-safe "^5.0.1"
propagate "^2.0.0"

Expand Down Expand Up @@ -4389,6 +4424,11 @@ optionator@^0.9.1:
type-check "^0.4.0"
word-wrap "^1.2.3"

outvariant@^1.4.0, outvariant@^1.4.3:
version "1.4.3"
resolved "https://registry.yarnpkg.com/outvariant/-/outvariant-1.4.3.tgz#221c1bfc093e8fec7075497e7799fdbf43d14873"
integrity sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA==

p-finally@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"
Expand Down Expand Up @@ -5061,6 +5101,11 @@ sprintf-js@~1.0.2:
version "1.0.3"
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"

strict-event-emitter@^0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/strict-event-emitter/-/strict-event-emitter-0.5.1.tgz#1602ece81c51574ca39c6815e09f1a3e8550bd93"
integrity sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ==

string-argv@^0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da"
Expand Down
Loading