Skip to content

Commit d421887

Browse files
committed
chore: update deps + jest to vitest
1 parent 7a48882 commit d421887

File tree

9 files changed

+6244
-6860
lines changed

9 files changed

+6244
-6860
lines changed

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@
2222
"@vue/eslint-config-typescript": "^7.0.0",
2323
"conventional-changelog-cli": "^2.2.2",
2424
"core-js": "^3.23.2",
25-
"esbuild": "^0.8.57",
26-
"esbuild-node-externals": "^1.4.1",
25+
"esbuild": "^0.25.0",
26+
"esbuild-node-externals": "^1.18.0",
2727
"eslint": "^7.32.0",
2828
"eslint-plugin-import": "^2.26.0",
2929
"eslint-plugin-node": "^11.1.0",
3030
"eslint-plugin-promise": "^4.3.1",
3131
"eslint-plugin-standard": "^5.0.0",
3232
"eslint-plugin-vue": "^7.20.0",
33-
"typescript": "^4.7.4"
33+
"typescript": "^5.8.2"
3434
},
35-
"packageManager": "pnpm@9.7.1",
35+
"packageManager": "pnpm@10.6.1+sha512.40ee09af407fa9fbb5fbfb8e1cb40fbb74c0af0c3e10e9224d7b53c7658528615b2c92450e74cfad91e3a2dcafe3ce4050d80bda71d757756d2ce2b66213e9a3",
3636
"pnpm": {
3737
"overrides": {
3838
"eslint-scope": "^5",

packages/test-e2e-ssr/src/components/LazyQueryImmediately.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ export default defineComponent({
4646
<div>Loaded channel: {{ channel.label }}</div>
4747
<div>Messages: {{ channel.messages.length }}</div>
4848

49-
<div v-for="message in channel.messages" :key="message.id" class="message">
49+
<div
50+
v-for="message in channel.messages"
51+
:key="message.id"
52+
class="message"
53+
>
5054
{{ message.text }}
5155
</div>
5256
</div>

packages/vue-apollo-components/package.json

-4
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"babel-core": "^7.0.0-bridge.0",
5858
"cross-env": "^6.0.3",
5959
"graphql": "^15.8.0",
60-
"jest": "^24.9.0",
6160
"nodemon": "^1.19.4",
6261
"rimraf": "^3.0.2",
6362
"rollup": "^1.32.1",
@@ -69,8 +68,5 @@
6968
"uglify-es": "^3.3.9",
7069
"vue": "^3.2.37",
7170
"vue-property-decorator": "^8.5.1"
72-
},
73-
"jest": {
74-
"testRegex": "tests/unit/.*\\.test.js$"
7571
}
7672
}

packages/vue-apollo-composable/src/useQuery.ts

+19-7
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ import type {
1919
ApolloQueryResult,
2020
SubscribeToMoreOptions,
2121
FetchMoreQueryOptions,
22-
FetchMoreOptions,
2322
ObservableSubscription,
2423
TypedDocumentNode,
2524
ApolloError,
2625
ApolloClient,
26+
UpdateQueryMapFn,
27+
Unmasked,
28+
MaybeMasked,
2729
} from '@apollo/client/core/index.js'
2830
import { throttle, debounce } from 'throttle-debounce'
2931
import { useApolloClient } from './useApolloClient'
@@ -81,9 +83,14 @@ export interface UseQueryReturn<TResult, TVariables extends OperationVariables>
8183
options: UseQueryOptions<TResult, TVariables> | Ref<UseQueryOptions<TResult, TVariables>>
8284
query: Ref<ObservableQuery<TResult, TVariables> | null | undefined>
8385
refetch: (variables?: TVariables) => Promise<ApolloQueryResult<TResult>> | undefined
84-
fetchMore: (options: FetchMoreQueryOptions<TVariables, TResult> & FetchMoreOptions<TResult, TVariables>) => Promise<ApolloQueryResult<TResult>> | undefined
85-
updateQuery: (mapFn: (previousQueryResult: TResult, options: Pick<WatchQueryOptions<TVariables, TResult>, 'variables'>) => TResult) => void
86-
subscribeToMore: <TSubscriptionVariables = OperationVariables, TSubscriptionData = TResult>(options: SubscribeToMoreOptions<TResult, TSubscriptionVariables, TSubscriptionData> | Ref<SubscribeToMoreOptions<TResult, TSubscriptionVariables, TSubscriptionData>> | ReactiveFunction<SubscribeToMoreOptions<TResult, TSubscriptionVariables, TSubscriptionData>>) => void
86+
fetchMore: <TFetchData = TResult, TFetchVars extends OperationVariables = TVariables> (options: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
87+
updateQuery?: (previousQueryResult: Unmasked<TResult>, options: {
88+
fetchMoreResult: Unmasked<TFetchData>
89+
variables: TFetchVars
90+
}) => Unmasked<TResult>
91+
}) => Promise<ApolloQueryResult<MaybeMasked<TFetchData>>> | undefined
92+
updateQuery: (mapFn: UpdateQueryMapFn<TResult, TVariables>) => void
93+
subscribeToMore: <TSubscriptionVariables extends OperationVariables = OperationVariables, TSubscriptionData = TResult>(options: SubscribeToMoreOptions<TResult, TSubscriptionVariables, TSubscriptionData> | Ref<SubscribeToMoreOptions<TResult, TSubscriptionVariables, TSubscriptionData>> | ReactiveFunction<SubscribeToMoreOptions<TResult, TSubscriptionVariables, TSubscriptionData>>) => void
8794
onResult: (fn: (param: ApolloQueryResult<TResult>, context: OnResultContext) => void) => {
8895
off: () => void
8996
}
@@ -545,15 +552,20 @@ export function useQueryImpl<
545552

546553
// Update Query
547554

548-
function updateQuery (mapFn: (previousQueryResult: TResult, options: Pick<WatchQueryOptions<TVariables, TResult>, 'variables'>) => TResult) {
555+
function updateQuery (mapFn: UpdateQueryMapFn<TResult, TVariables>) {
549556
if (query.value) {
550557
query.value.updateQuery(mapFn)
551558
}
552559
}
553560

554561
// Fetch more
555562

556-
function fetchMore (options: FetchMoreQueryOptions<TVariables, TResult> & FetchMoreOptions<TResult, TVariables>) {
563+
function fetchMore <TFetchData = TResult, TFetchVars extends OperationVariables = TVariables> (options: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
564+
updateQuery?: (previousQueryResult: Unmasked<TResult>, options: {
565+
fetchMoreResult: Unmasked<TFetchData>
566+
variables: TFetchVars
567+
}) => Unmasked<TResult>
568+
}): Promise<ApolloQueryResult<MaybeMasked<TFetchData>>> | undefined {
557569
if (query.value) {
558570
error.value = null
559571
loading.value = true
@@ -571,7 +583,7 @@ export function useQueryImpl<
571583
const subscribeToMoreItems: SubscribeToMoreItem[] = []
572584

573585
function subscribeToMore<
574-
TSubscriptionVariables = OperationVariables,
586+
TSubscriptionVariables extends OperationVariables = OperationVariables,
575587
TSubscriptionData = TResult
576588
> (
577589
options: SubscribeToMoreOptions<TResult, TSubscriptionVariables, TSubscriptionData> |

packages/vue-apollo-composable/src/util/toApolloError.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ApolloError, isApolloError } from '@apollo/client/core/index.js'
2-
import { GraphQLErrors } from '@apollo/client/errors/index.js'
2+
import type { GraphQLFormattedError } from 'graphql'
33

44
export function toApolloError (error: unknown): ApolloError {
55
if (!(error instanceof Error)) {
@@ -16,7 +16,7 @@ export function toApolloError (error: unknown): ApolloError {
1616
return new ApolloError({ networkError: error, errorMessage: error.message })
1717
}
1818

19-
export function resultErrorsToApolloError (errors: GraphQLErrors): ApolloError {
19+
export function resultErrorsToApolloError (errors: ReadonlyArray<GraphQLFormattedError>): ApolloError {
2020
return new ApolloError({
2121
graphQLErrors: errors,
2222
errorMessage: `GraphQL response contains errors: ${errors.map((e: any) => e.message).join(' | ')}`,

packages/vue-apollo-option/package.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"dev": "nodemon --exec 'pnpm run build:es && pnpm run build:umd' --watch src --watch lib",
2424
"test": "pnpm run test:types && pnpm run test:unit",
2525
"test:types": "tsc -p types/test",
26-
"test:unit": "jest"
26+
"test:unit": "vitest run"
2727
},
2828
"repository": {
2929
"type": "git",
@@ -66,7 +66,6 @@
6666
"cross-env": "^6.0.3",
6767
"graphql": "^15.8.0",
6868
"graphql-tag": "^2.12.6",
69-
"jest": "^24.9.0",
7069
"nodemon": "^1.19.4",
7170
"rimraf": "^3.0.2",
7271
"rollup": "^1.32.1",
@@ -76,10 +75,8 @@
7675
"rollup-plugin-replace": "^2.2.0",
7776
"rollup-plugin-uglify": "^6.0.4",
7877
"uglify-es": "^3.3.9",
78+
"vitest": "^3.0.8",
7979
"vue": "^3.2.37",
8080
"vue-property-decorator": "^10.0.0-rc.3"
81-
},
82-
"jest": {
83-
"testRegex": "tests/unit/.*\\.test.js$"
8481
}
8582
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineConfig } from 'vitest/config'
2+
3+
export default defineConfig({
4+
test: {
5+
globals: true,
6+
},
7+
})

0 commit comments

Comments
 (0)