Skip to content

Commit cea71c9

Browse files
dependabot[bot]wjhsfcolincasey
authored
Bump the dev-dependencies group with 8 updates (#551)
* Bump the dev-dependencies group with 8 updates Bumps the dev-dependencies group with 8 updates: | Package | From | To | | --- | --- | --- | | [@microsoft/api-documenter](https://github.com/microsoft/rushstack/tree/HEAD/apps/api-documenter) | `7.27.3` | `7.28.1` | | [@microsoft/api-extractor](https://github.com/microsoft/rushstack/tree/HEAD/apps/api-extractor) | `7.53.3` | `7.55.1` | | [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `20.19.24` | `20.19.25` | | [@vitest/eslint-plugin](https://github.com/vitest-dev/eslint-plugin-vitest) | `1.4.0` | `1.5.1` | | [prettier](https://github.com/prettier/prettier) | `3.6.2` | `3.7.3` | | [tsup](https://github.com/egoist/tsup) | `8.5.0` | `8.5.1` | | [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) | `8.46.3` | `8.48.0` | | [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) | `4.0.7` | `4.0.14` | Updates `@microsoft/api-documenter` from 7.27.3 to 7.28.1 - [Changelog](https://github.com/microsoft/rushstack/blob/main/apps/api-documenter/CHANGELOG.md) - [Commits](https://github.com/microsoft/rushstack/commits/@microsoft/api-documenter_v7.28.1/apps/api-documenter) Updates `@microsoft/api-extractor` from 7.53.3 to 7.55.1 - [Changelog](https://github.com/microsoft/rushstack/blob/main/apps/api-extractor/CHANGELOG.md) - [Commits](https://github.com/microsoft/rushstack/commits/@microsoft/api-extractor_v7.55.1/apps/api-extractor) Updates `@types/node` from 20.19.24 to 20.19.25 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Updates `@vitest/eslint-plugin` from 1.4.0 to 1.5.1 - [Release notes](https://github.com/vitest-dev/eslint-plugin-vitest/releases) - [Commits](vitest-dev/eslint-plugin-vitest@v1.4.0...v1.5.1) Updates `prettier` from 3.6.2 to 3.7.3 - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](prettier/prettier@3.6.2...3.7.3) Updates `tsup` from 8.5.0 to 8.5.1 - [Release notes](https://github.com/egoist/tsup/releases) - [Commits](egoist/tsup@v8.5.0...v8.5.1) Updates `typescript-eslint` from 8.46.3 to 8.48.0 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.48.0/packages/typescript-eslint) Updates `vitest` from 4.0.7 to 4.0.14 - [Release notes](https://github.com/vitest-dev/vitest/releases) - [Commits](https://github.com/vitest-dev/vitest/commits/v4.0.14/packages/vitest) --- updated-dependencies: - dependency-name: "@microsoft/api-documenter" dependency-version: 7.28.1 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dev-dependencies - dependency-name: "@microsoft/api-extractor" dependency-version: 7.55.1 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dev-dependencies - dependency-name: "@types/node" dependency-version: 20.19.25 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dev-dependencies - dependency-name: "@vitest/eslint-plugin" dependency-version: 1.5.1 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dev-dependencies - dependency-name: prettier dependency-version: 3.7.3 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dev-dependencies - dependency-name: tsup dependency-version: 8.5.1 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dev-dependencies - dependency-name: typescript-eslint dependency-version: 8.48.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dev-dependencies - dependency-name: vitest dependency-version: 4.0.14 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dev-dependencies ... Signed-off-by: dependabot[bot] <[email protected]> * prettier * chore: linter fixes --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Will Harney <[email protected]> Co-authored-by: Colin Casey <[email protected]>
1 parent c5f7706 commit cea71c9

File tree

7 files changed

+787
-604
lines changed

7 files changed

+787
-604
lines changed

lib/__tests__/cookieJar.spec.ts

Lines changed: 33 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
*/
3131

3232
/* eslint vitest/expect-expect: [error, {assertFunctionNames: [expect, assertions]}] */
33+
/* eslint vitest/no-standalone-expect: [error, {additionalTestBlockFunctions: [apiVariants, beforeEach]}]*/
3334

3435
import {
3536
afterAll,
@@ -1539,19 +1540,16 @@ describe.each(['local', 'example', 'invalid', 'localhost', 'test'])(
15391540
rejectPublicSuffixes: true,
15401541
allowSpecialUseDomain: false,
15411542
})
1542-
try {
1543-
await cookieJar.setCookie(
1543+
await expect(
1544+
cookieJar.setCookie(
15441545
`settingThisShouldPass=true; Domain=dev.${specialUseDomain}; Path=/;`,
15451546
`http://dev.${specialUseDomain}`,
1546-
)
1547-
} catch (e) {
1548-
if (!(e instanceof Error)) {
1549-
throw new Error('This should be an error instance')
1550-
}
1551-
expect(e.message).toBe(
1552-
`Cookie has domain set to the public suffix "${specialUseDomain}" which is a special use domain. To allow this, configure your CookieJar with {allowSpecialUseDomain: true, rejectPublicSuffixes: false}.`,
1553-
)
1554-
}
1547+
),
1548+
).rejects.toThrow(
1549+
`Cookie has domain set to the public suffix "${
1550+
specialUseDomain
1551+
}" which is a special use domain. To allow this, configure your CookieJar with {allowSpecialUseDomain: true, rejectPublicSuffixes: false}.`,
1552+
)
15551553
})
15561554
},
15571555
)
@@ -1590,19 +1588,16 @@ describe.each(['local', 'example', 'invalid', 'localhost', 'test'])(
15901588
it('should reject special domain cookies if allowSpecialUseDomain is set to the default value', async () => {
15911589
expect.assertions(1)
15921590
const cookieJar = new CookieJar()
1593-
try {
1594-
await cookieJar.setCookie(
1591+
await expect(
1592+
cookieJar.setCookie(
15951593
`settingThisShouldPass=true; Domain=${specialUseDomain}; Path=/;`,
15961594
`http://${specialUseDomain}`,
1597-
)
1598-
} catch (e) {
1599-
if (!(e instanceof Error)) {
1600-
throw new Error('This should be an error instance')
1601-
}
1602-
expect(e.message).toBe(
1603-
`Cookie has domain set to the public suffix "${specialUseDomain}" which is a special use domain. To allow this, configure your CookieJar with {allowSpecialUseDomain: true, rejectPublicSuffixes: false}.`,
1604-
)
1605-
}
1595+
),
1596+
).rejects.toThrow(
1597+
`Cookie has domain set to the public suffix "${
1598+
specialUseDomain
1599+
}" which is a special use domain. To allow this, configure your CookieJar with {allowSpecialUseDomain: true, rejectPublicSuffixes: false}.`,
1600+
)
16061601
})
16071602
}
16081603

@@ -1638,19 +1633,16 @@ describe.each(['local', 'example', 'invalid', 'localhost', 'test'])(
16381633
rejectPublicSuffixes: true,
16391634
allowSpecialUseDomain: true,
16401635
})
1641-
try {
1642-
await cookieJar.setCookie(
1636+
await expect(
1637+
cookieJar.setCookie(
16431638
`settingThisShouldPass=true; Domain=${specialUseDomain}; Path=/;`,
16441639
`http://${specialUseDomain}`,
1645-
)
1646-
} catch (e) {
1647-
if (!(e instanceof Error)) {
1648-
throw new Error('This should be an error instance')
1649-
}
1650-
expect(e.message).toBe(
1651-
`Cookie has domain set to the public suffix "${specialUseDomain}" which is a special use domain. To allow this, configure your CookieJar with {allowSpecialUseDomain: true, rejectPublicSuffixes: false}.`,
1652-
)
1653-
}
1640+
),
1641+
).rejects.toThrow(
1642+
`Cookie has domain set to the public suffix "${
1643+
specialUseDomain
1644+
}" which is a special use domain. To allow this, configure your CookieJar with {allowSpecialUseDomain: true, rejectPublicSuffixes: false}.`,
1645+
)
16541646
})
16551647
}
16561648

@@ -1660,19 +1652,16 @@ describe.each(['local', 'example', 'invalid', 'localhost', 'test'])(
16601652
rejectPublicSuffixes: true,
16611653
allowSpecialUseDomain: false,
16621654
})
1663-
try {
1664-
await cookieJar.setCookie(
1655+
await expect(
1656+
cookieJar.setCookie(
16651657
`settingThisShouldPass=true; Domain=${specialUseDomain}; Path=/;`,
16661658
`http://${specialUseDomain}`,
1667-
)
1668-
} catch (e) {
1669-
if (!(e instanceof Error)) {
1670-
throw new Error('This should be an error instance')
1671-
}
1672-
expect(e.message).toBe(
1673-
`Cookie has domain set to the public suffix "${specialUseDomain}" which is a special use domain. To allow this, configure your CookieJar with {allowSpecialUseDomain: true, rejectPublicSuffixes: false}.`,
1674-
)
1675-
}
1659+
),
1660+
).rejects.toThrow(
1661+
`Cookie has domain set to the public suffix "${
1662+
specialUseDomain
1663+
}" which is a special use domain. To allow this, configure your CookieJar with {allowSpecialUseDomain: true, rejectPublicSuffixes: false}.`,
1664+
)
16761665
})
16771666
},
16781667
)

lib/__tests__/cookiePrefixes.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ let cookieJar: CookieJar
66
const insecureUrl = 'http://www.example.com'
77
const secureUrl = 'https://www.example.com'
88

9+
/* eslint vitest/no-standalone-expect: [error, {additionalTestBlockFunctions: [beforeEach]}]*/
10+
911
describe('When `prefixSecurity` is enabled for `CookieJar`', () => {
1012
describe('silent', () => {
1113
beforeEach(() => {

lib/__tests__/ietf.spec.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -73,30 +73,14 @@ describe('IETF http state tests', () => {
7373
it.each(exampleDates)(
7474
`ietf_data/dates/examples: $test`,
7575
({ test, expected }) => {
76-
if (expected) {
77-
const date = parseDate(test)
78-
if (!date) {
79-
throw new Error('This should have parsed')
80-
}
81-
expect(date.toUTCString()).toBe(expected)
82-
} else {
83-
expect(parseDate(test)).toBeUndefined()
84-
}
76+
expect(parseDate(test)?.toUTCString()).toBe(expected || undefined)
8577
},
8678
)
8779

8880
it.each(bsdExampleDates)(
8981
`ietf_data/dates/bsd_examples: $test`,
9082
({ test, expected }) => {
91-
if (expected) {
92-
const date = parseDate(test)
93-
if (!date) {
94-
throw new Error('This should have parsed')
95-
}
96-
expect(date.toUTCString()).toBe(expected)
97-
} else {
98-
expect(parseDate(test)).toBeUndefined()
99-
}
83+
expect(parseDate(test)?.toUTCString()).toBe(expected || undefined)
10084
},
10185
)
10286
})

lib/__tests__/jarSerialization.spec.ts

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -253,32 +253,24 @@ describe('cookieJar serialization', () => {
253253
domain?: string
254254
path?: string
255255
}
256-
expect(typeof parsedValue.domain).toBe('string')
257-
expect(typeof parsedValue.path).toBe('string')
256+
// eslint-disable-next-line vitest/no-conditional-expect
257+
expect(parsedValue.domain).toBeTypeOf('string')
258+
// eslint-disable-next-line vitest/no-conditional-expect
259+
expect(parsedValue.path).toBeTypeOf('string')
258260
}
259261

260-
if (
261-
serializedCookie.key === 'infExp' ||
262-
serializedCookie.key === 'max'
263-
) {
264-
expect(serializedCookie.expires).toBeFalsy()
265-
} else {
266-
expect(serializedCookie.expires).toBe(expires.toISOString())
267-
}
262+
const expiry =
263+
serializedCookie.key === 'infExp' || serializedCookie.key === 'max'
264+
? undefined
265+
: expires.toISOString()
266+
expect(serializedCookie.expires).toBe(expiry)
268267

269-
if (serializedCookie.key === 'max') {
270-
expect(serializedCookie.maxAge).toBe(3600)
271-
} else {
272-
expect(serializedCookie.maxAge).toBeUndefined()
273-
}
268+
const maxAge = serializedCookie.key === 'max' ? 3600 : undefined
269+
expect(serializedCookie.maxAge).toBe(maxAge)
274270

275-
if (serializedCookie.key === 'flags') {
276-
expect(serializedCookie.secure).toBe(true)
277-
expect(serializedCookie.httpOnly).toBe(true)
278-
} else {
279-
expect(serializedCookie.secure).toBeUndefined()
280-
expect(serializedCookie.httpOnly).toBeUndefined()
281-
}
271+
const flag = serializedCookie.key === 'flags' ? true : undefined
272+
expect(serializedCookie.secure).toBe(flag)
273+
expect(serializedCookie.httpOnly).toBe(flag)
282274

283275
expect(serializedCookie.hostOnly).toBe(serializedCookie.key === 'honly')
284276

lib/__tests__/parse.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,11 @@ describe('Cookie.parse', () => {
407407

408408
const value = input === undefined ? undefined : input.valueOf()
409409
const cookie = Cookie.parse(value as string, parseOptions)
410+
// eslint-disable-next-line vitest/no-conditional-expect
410411
expect(cookie).toEqual(output && expect.objectContaining(output))
411412

412413
if (cookie && typeof assertValidateReturns === 'boolean') {
414+
// eslint-disable-next-line vitest/no-conditional-expect
413415
expect(cookie.validate()).toBe(assertValidateReturns)
414416
}
415417
})

lib/cookie/cookieJar.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,9 @@ function isHostPrefixConditionMet(cookie: Cookie): boolean {
276276
!startsWithHostPrefix ||
277277
Boolean(
278278
cookie.secure &&
279-
cookie.hostOnly &&
280-
cookie.path != null &&
281-
cookie.path === '/',
279+
cookie.hostOnly &&
280+
cookie.path != null &&
281+
cookie.path === '/',
282282
)
283283
)
284284
}

0 commit comments

Comments
 (0)