Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump the dev-dependencies group with 2 updates #448

Merged
Merged
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
22 changes: 11 additions & 11 deletions lib/__tests__/cookieJar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ describe('CookieJar', () => {
cookieJar.setCookie('=b', 'http://example.com/index.html', {
loose: false,
}),
).rejects.toThrowError('Cookie failed to parse')
).rejects.toThrow('Cookie failed to parse')
})

it('should not default to loose: true when using map', () => {
Expand Down Expand Up @@ -254,7 +254,7 @@ describe('CookieJar', () => {
'a=b; Domain=fooxample.com; Path=/',
'http://example.com/index.html',
),
).rejects.toThrowError(
).rejects.toThrow(
"Cookie not in this host's domain. Cookie:fooxample.com Request:example.com",
)
})
Expand All @@ -266,7 +266,7 @@ describe('CookieJar', () => {
'a=b; Domain=www.example.com; Path=/',
'http://example.com/index.html',
),
).rejects.toThrowError(
).rejects.toThrow(
"Cookie not in this host's domain. Cookie:www.example.com Request:example.com",
)
})
Expand Down Expand Up @@ -301,7 +301,7 @@ describe('CookieJar', () => {
'http://example.com/index.html',
{ http: false },
),
).rejects.toThrowError("Cookie is HttpOnly and this isn't an HTTP API")
).rejects.toThrow("Cookie is HttpOnly and this isn't an HTTP API")
})

it('should not fail when using an httpOnly cookie when using a non-HTTP API', async () => {
Expand Down Expand Up @@ -1069,7 +1069,7 @@ describe('setCookie errors', () => {
const cookieJar = new CookieJar()
await expect(
cookieJar.setCookie('i=9; Domain=kyoto.jp; Path=/', 'http://kyoto.jp'),
).rejects.toThrowError('Cookie has domain set to a public suffix')
).rejects.toThrow('Cookie has domain set to a public suffix')
})

it('should throw an error if domains do not match', async () => {
Expand All @@ -1079,7 +1079,7 @@ describe('setCookie errors', () => {
'j=10; Domain=google.com; Path=/',
'http://google.ca',
),
).rejects.toThrowError(
).rejects.toThrow(
`Cookie not in this host's domain. Cookie:google.com Request:google.ca`,
)
})
Expand All @@ -1097,7 +1097,7 @@ describe('setCookie errors', () => {
'http://example.ca',
{ http: false },
),
).rejects.toThrowError("old Cookie is HttpOnly and this isn't an HTTP API")
).rejects.toThrow("old Cookie is HttpOnly and this isn't an HTTP API")

const cookies = await cookieJar.getCookies('http://example.ca', {
http: true,
Expand Down Expand Up @@ -1149,7 +1149,7 @@ it('should fix issue #132', async () => {
await expect(
// @ts-expect-error test case is explicitly testing invalid input
cookieJar.setCookie({ key: 'x', value: 'y' }, 'http://example.com/'),
).rejects.toThrowError(
).rejects.toThrow(
'First argument to setCookie must be a Cookie object or string',
)
})
Expand Down Expand Up @@ -1186,9 +1186,9 @@ it('should fix issue #145 - missing 2nd url parameter', async () => {

it('should fix issue #197 - CookieJar().setCookie throws an error when empty cookie is passed', async () => {
const cookieJar = new CookieJar()
await expect(
cookieJar.setCookie('', 'https://google.com'),
).rejects.toThrowError('Cookie failed to parse')
await expect(cookieJar.setCookie('', 'https://google.com')).rejects.toThrow(
'Cookie failed to parse',
)
})

it('should fix issue #282 - Prototype pollution when setting a cookie with the domain __proto__', () => {
Expand Down
4 changes: 2 additions & 2 deletions lib/__tests__/cookiePrefixes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ describe('When `prefixSecurity` is enabled for `CookieJar`', () => {
insecureUrl,
{},
),
).rejects.toThrowError(
).rejects.toThrow(
'Cookie has __Secure prefix but Secure attribute is not set',
)
})
Expand Down Expand Up @@ -161,7 +161,7 @@ describe('When `prefixSecurity` is enabled for `CookieJar`', () => {
secureUrl,
{},
),
).rejects.toThrowError(
).rejects.toThrow(
`Cookie has __Host prefix but either Secure or HostOnly attribute is not set or Path is not '/'`,
)
})
Expand Down
6 changes: 3 additions & 3 deletions lib/__tests__/jarSerialization.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('cookieJar serialization', () => {
store.synchronous = true

const jar = new CookieJar(store)
expect(() => jar.toJSON()).toThrowError(
expect(() => jar.toJSON()).toThrow(
'getAllCookies is not implemented (therefore jar cannot be serialized)',
)
})
Expand All @@ -76,7 +76,7 @@ describe('cookieJar serialization', () => {
const store = new MemoryCookieStore()
store.synchronous = false
const jar = new CookieJar(store)
expect(() => jar.toJSON()).toThrowError(
expect(() => jar.toJSON()).toThrow(
'CookieJar store is not synchronous; use async API instead.',
)
})
Expand Down Expand Up @@ -165,7 +165,7 @@ describe('cookieJar serialization', () => {
it('should raise an error when attempting to synchronously clone to an async store', () => {
const newStore = new MemoryCookieStore()
newStore.synchronous = false
expect(() => jar.cloneSync(newStore)).toThrowError(
expect(() => jar.cloneSync(newStore)).toThrow(
'CookieJar clone destination store is not synchronous; use async API instead.',
)
})
Expand Down
2 changes: 1 addition & 1 deletion lib/__tests__/removeAll.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe('store removeAllCookies API', () => {
_removeCookie.call(store, domain, path, key, callback)
})

await expect(jar.removeAllCookies()).rejects.toThrowError(
await expect(jar.removeAllCookies()).rejects.toThrow(
'something happened 1',
)

Expand Down
4 changes: 2 additions & 2 deletions lib/__tests__/sameSite.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,15 @@ describe('Same-Site Cookies', function () {
it('should not allow strict cookie to be set', async () => {
await expect(
cookieJar.setCookie(strict, url, { sameSiteContext: 'none' }),
).rejects.toThrowError(
).rejects.toThrow(
'Cookie is SameSite but this is a cross-origin request',
)
})

it('should not allow lax cookie to be set', async () => {
await expect(
cookieJar.setCookie(lax, url, { sameSiteContext: 'none' }),
).rejects.toThrowError(
).rejects.toThrow(
'Cookie is SameSite but this is a cross-origin request',
)
})
Expand Down
5 changes: 2 additions & 3 deletions lib/cookie/cookie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function parseCookiePair(
if (looseMode) {
if (firstEq === 0) {
// '=' is immediately at start
cookiePair = cookiePair.substr(1)
cookiePair = cookiePair.substring(1)
firstEq = cookiePair.indexOf('=') // might still need to split on '='
}
} else {
Expand Down Expand Up @@ -284,8 +284,7 @@ function fromJSON(str: unknown): Cookie | undefined {
if (typeof str === 'string') {
try {
obj = JSON.parse(str)
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (e) {
} catch {
return undefined
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion lib/cookie/cookieJar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ export class CookieJar {
): Promise<void> {
return this.putCookie(newCookie).then(
() => cb?.(null),
(error: Error) => cb?.(error),
(error: unknown) => cb?.(error as Error),
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/cookie/domainMatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function domainMatch(

/* " * The last character of the string that is not included in the
* domain string is a %x2E (".") character." */
if (_str.substr(idx - 1, 1) !== '.') {
if (_str.substring(idx - 1, idx) !== '.') {
return false // doesn't align on "."
}

Expand Down
Loading