Skip to content

Commit eda1829

Browse files
authored
Merge pull request #1936 from seriouslag/chore/update-to-vitest-3
chore(test): update to vitest 3
2 parents b885405 + ba2e5ca commit eda1829

File tree

118 files changed

+3207
-3343
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+3207
-3343
lines changed

.changeset/sharp-kangaroos-try.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hey-api/openapi-ts": patch
3+
---
4+
5+
fix: add return type to TanStack Query mutations

examples/openapi-ts-axios/package.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,20 @@
2222
},
2323
"devDependencies": {
2424
"@hey-api/openapi-ts": "workspace:*",
25+
"@config/vite-base": "workspace:*",
2526
"@types/react": "19.0.1",
2627
"@types/react-dom": "19.0.1",
27-
"@typescript-eslint/eslint-plugin": "7.18.0",
28-
"@typescript-eslint/parser": "7.15.0",
29-
"@vitejs/plugin-react": "4.3.1",
28+
"@typescript-eslint/eslint-plugin": "8.29.1",
29+
"@typescript-eslint/parser": "8.29.1",
30+
"@vitejs/plugin-react": "4.4.0-beta.1",
3031
"autoprefixer": "10.4.19",
3132
"eslint": "9.17.0",
32-
"eslint-plugin-react-hooks": "4.6.2",
33+
"eslint-plugin-react-hooks": "5.2.0",
3334
"eslint-plugin-react-refresh": "0.4.7",
3435
"postcss": "8.4.41",
3536
"prettier": "3.4.2",
3637
"tailwindcss": "3.4.9",
37-
"typescript": "5.5.3",
38-
"vite": "6.0.13"
38+
"typescript": "5.8.3",
39+
"vite": "6.2.6"
3940
}
4041
}
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { createViteConfig } from '@config/vite-base';
12
import react from '@vitejs/plugin-react';
2-
import { defineConfig } from 'vite';
33

44
// https://vitejs.dev/config/
5-
export default defineConfig({
5+
export default createViteConfig({
66
plugins: [react()],
77
});
+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
{
2+
"openapi": "3.1.0",
3+
"info": {
4+
"title": "Petstore API",
5+
"version": "1.0.0",
6+
"description": "A sample API that uses a petstore as an example"
7+
},
8+
"servers": [
9+
{
10+
"url": "http://localhost:3000/v3"
11+
}
12+
],
13+
"paths": {
14+
"/pets/{petId}": {
15+
"get": {
16+
"summary": "Find pet by ID",
17+
"operationId": "showPetById",
18+
"parameters": [
19+
{
20+
"name": "petId",
21+
"in": "path",
22+
"required": true,
23+
"schema": {
24+
"type": "string"
25+
}
26+
}
27+
],
28+
"responses": {
29+
"200": {
30+
"description": "Pet found",
31+
"content": {
32+
"application/json": {
33+
"schema": {
34+
"type": "object",
35+
"properties": {
36+
"id": {
37+
"type": "string"
38+
},
39+
"name": {
40+
"type": "string"
41+
}
42+
}
43+
}
44+
}
45+
}
46+
}
47+
}
48+
}
49+
},
50+
"/pets": {
51+
"get": {
52+
"summary": "List all pets",
53+
"operationId": "listPets",
54+
"responses": {
55+
"200": {
56+
"description": "A list of pets",
57+
"content": {
58+
"application/json": {
59+
"schema": {
60+
"type": "array",
61+
"items": {
62+
"type": "object",
63+
"properties": {
64+
"id": {
65+
"type": "string"
66+
},
67+
"name": {
68+
"type": "string"
69+
}
70+
}
71+
}
72+
}
73+
}
74+
}
75+
}
76+
}
77+
},
78+
"post": {
79+
"summary": "Create a pet",
80+
"operationId": "createPets",
81+
"responses": {
82+
"201": {
83+
"description": "Pet created"
84+
}
85+
}
86+
}
87+
}
88+
}
89+
}

examples/openapi-ts-fastify/package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
},
1616
"devDependencies": {
1717
"@hey-api/openapi-ts": "workspace:*",
18+
"@config/vite-base": "workspace:*",
1819
"eslint": "9.17.0",
1920
"prettier": "3.4.2",
20-
"typescript": "5.5.3",
21-
"vitest": "1.6.0"
21+
"typescript": "5.8.3",
22+
"vite": "6.2.6",
23+
"vitest": "3.1.1"
2224
}
2325
}
+7-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { buildServer } from './server';
22

3-
const fastify = buildServer();
4-
5-
fastify.listen({ port: 3000 }, function (err) {
6-
if (err) {
7-
fastify.log.error(err);
8-
process.exit(1);
9-
}
3+
buildServer().then((fastify) => {
4+
fastify.listen({ port: 3000 }, function (err) {
5+
if (err) {
6+
fastify.log.error(err);
7+
process.exit(1);
8+
}
9+
});
1010
});

examples/openapi-ts-fastify/src/server.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1+
import { readFileSync } from 'node:fs';
2+
import { join } from 'node:path';
3+
14
import Fastify from 'fastify';
25
import glue from 'fastify-openapi-glue';
36

47
import { serviceHandlers } from './handlers';
58

6-
export const buildServer = () => {
9+
export const buildServer = async () => {
710
const fastify = Fastify();
811

9-
const specification = fetch(
10-
'https://gist.githubusercontent.com/seriousme/55bd4c8ba2e598e416bb5543dcd362dc/raw/cf0b86ba37bb54bf1a6bf047c0ecf2a0ce4c62e0/petstore-v3.1.json',
11-
)
12-
.then((reply) => reply.json())
13-
.then((data) => data);
14-
console.log(specification);
12+
const specificationPath = join(__dirname, '..', 'openapi.json');
13+
const specificationJson = JSON.parse(
14+
readFileSync(specificationPath, 'utf-8'),
15+
);
1516

1617
fastify.register(glue, {
1718
prefix: 'v3',
1819
serviceHandlers,
19-
specification,
20+
specification: specificationJson,
2021
});
2122

2223
return fastify;

examples/openapi-ts-fastify/test/pets.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('/pet/findByTags', () => {
88
let server: FastifyInstance;
99

1010
beforeAll(async () => {
11-
server = buildServer();
11+
server = await buildServer();
1212
await server.listen();
1313

1414
// @ts-ignore

examples/openapi-ts-fastify/tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
"esModuleInterop": true,
1010
"skipLibCheck": true,
1111
"baseUrl": "."
12-
}
12+
},
13+
"references": [{ "path": "./tsconfig.node.json" }]
1314
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"compilerOptions": {
3+
"composite": true,
4+
"skipLibCheck": true,
5+
"module": "ESNext",
6+
"moduleResolution": "bundler",
7+
"allowSyntheticDefaultImports": true,
8+
"strict": true
9+
},
10+
"include": ["vite.config.ts"]
11+
}
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { fileURLToPath } from 'node:url';
2+
3+
import { createVitestConfig } from '@config/vite-base';
4+
5+
// https://vitejs.dev/config/
6+
export default createVitestConfig(
7+
fileURLToPath(new URL('./', import.meta.url)),
8+
{
9+
test: {
10+
environment: 'node',
11+
globals: true,
12+
include: ['test/**/*.test.ts'],
13+
watch: false,
14+
},
15+
},
16+
);

examples/openapi-ts-fetch/package.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,20 @@
2121
},
2222
"devDependencies": {
2323
"@hey-api/openapi-ts": "workspace:*",
24+
"@config/vite-base": "workspace:*",
2425
"@types/react": "19.0.1",
2526
"@types/react-dom": "19.0.1",
26-
"@typescript-eslint/eslint-plugin": "7.18.0",
27-
"@typescript-eslint/parser": "7.15.0",
28-
"@vitejs/plugin-react": "4.3.1",
27+
"@typescript-eslint/eslint-plugin": "8.29.1",
28+
"@typescript-eslint/parser": "8.29.1",
29+
"@vitejs/plugin-react": "4.4.0-beta.1",
2930
"autoprefixer": "10.4.19",
3031
"eslint": "9.17.0",
31-
"eslint-plugin-react-hooks": "4.6.2",
32+
"eslint-plugin-react-hooks": "5.2.0",
3233
"eslint-plugin-react-refresh": "0.4.7",
3334
"postcss": "8.4.41",
3435
"prettier": "3.4.2",
3536
"tailwindcss": "3.4.9",
36-
"typescript": "5.5.3",
37-
"vite": "6.0.13"
37+
"typescript": "5.8.3",
38+
"vite": "6.2.6"
3839
}
3940
}
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { createViteConfig } from '@config/vite-base';
12
import react from '@vitejs/plugin-react';
2-
import { defineConfig } from 'vite';
33

44
// https://vitejs.dev/config/
5-
export default defineConfig({
5+
export default createViteConfig({
66
plugins: [react()],
77
});

examples/openapi-ts-next/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
"eslint-config-next": "15.1.6",
2525
"postcss": "8.4.41",
2626
"tailwindcss": "3.4.9",
27-
"typescript": "5.5.3"
27+
"typescript": "5.8.3"
2828
}
2929
}

examples/openapi-ts-nuxt/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
"zod": "3.23.8"
2020
},
2121
"devDependencies": {
22-
"vite": "6.0.13"
22+
"vite": "6.2.6"
2323
}
2424
}

examples/openapi-ts-sample/package.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,20 @@
2121
},
2222
"devDependencies": {
2323
"@hey-api/openapi-ts": "workspace:*",
24+
"@config/vite-base": "workspace:*",
2425
"@types/react": "19.0.1",
2526
"@types/react-dom": "19.0.1",
26-
"@typescript-eslint/eslint-plugin": "7.18.0",
27-
"@typescript-eslint/parser": "7.15.0",
28-
"@vitejs/plugin-react": "4.3.1",
27+
"@typescript-eslint/eslint-plugin": "8.29.1",
28+
"@typescript-eslint/parser": "8.29.1",
29+
"@vitejs/plugin-react": "4.4.0-beta.1",
2930
"autoprefixer": "10.4.19",
3031
"eslint": "9.17.0",
31-
"eslint-plugin-react-hooks": "4.6.2",
32+
"eslint-plugin-react-hooks": "5.2.0",
3233
"eslint-plugin-react-refresh": "0.4.7",
3334
"postcss": "8.4.41",
3435
"prettier": "3.4.2",
3536
"tailwindcss": "3.4.9",
36-
"typescript": "5.5.3",
37-
"vite": "6.0.13"
37+
"typescript": "5.8.3",
38+
"vite": "6.2.6"
3839
}
3940
}
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { createViteConfig } from '@config/vite-base';
12
import react from '@vitejs/plugin-react';
2-
import { defineConfig } from 'vite';
33

44
// https://vitejs.dev/config/
5-
export default defineConfig({
5+
export default createViteConfig({
66
plugins: [react()],
77
});

examples/openapi-ts-tanstack-angular-query-experimental/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"@angular/platform-browser-dynamic": "^19.2.0",
2323
"@angular/router": "^19.2.0",
2424
"@hey-api/client-fetch": "workspace:*",
25-
"@tanstack/angular-query-experimental": "5.62.13",
25+
"@tanstack/angular-query-experimental": "5.73.3",
2626
"rxjs": "~7.8.0",
2727
"tslib": "^2.8.1",
2828
"zone.js": "~0.15.0"
@@ -39,6 +39,6 @@
3939
"karma-coverage": "~2.2.0",
4040
"karma-jasmine": "~5.1.0",
4141
"karma-jasmine-html-reporter": "~2.1.0",
42-
"typescript": "5.5.3"
42+
"typescript": "5.8.3"
4343
}
4444
}

examples/openapi-ts-tanstack-react-query/package.json

+9-8
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,30 @@
1313
},
1414
"dependencies": {
1515
"@hey-api/client-fetch": "workspace:*",
16+
"@config/vite-base": "workspace:*",
1617
"@radix-ui/react-form": "0.1.1",
1718
"@radix-ui/react-icons": "1.3.2",
1819
"@radix-ui/themes": "3.1.6",
19-
"@tanstack/react-query": "5.62.15",
20-
"@tanstack/react-query-devtools": "5.62.15",
20+
"@tanstack/react-query": "5.73.3",
21+
"@tanstack/react-query-devtools": "5.73.3",
2122
"react": "19.0.0",
2223
"react-dom": "19.0.0"
2324
},
2425
"devDependencies": {
2526
"@hey-api/openapi-ts": "workspace:*",
2627
"@types/react": "19.0.1",
2728
"@types/react-dom": "19.0.1",
28-
"@typescript-eslint/eslint-plugin": "7.18.0",
29-
"@typescript-eslint/parser": "7.15.0",
30-
"@vitejs/plugin-react": "4.3.1",
29+
"@typescript-eslint/eslint-plugin": "8.29.1",
30+
"@typescript-eslint/parser": "8.29.1",
31+
"@vitejs/plugin-react": "4.4.0-beta.1",
3132
"autoprefixer": "10.4.19",
3233
"eslint": "9.17.0",
33-
"eslint-plugin-react-hooks": "4.6.2",
34+
"eslint-plugin-react-hooks": "5.2.0",
3435
"eslint-plugin-react-refresh": "0.4.7",
3536
"postcss": "8.4.41",
3637
"prettier": "3.4.2",
3738
"tailwindcss": "3.4.9",
38-
"typescript": "5.5.3",
39-
"vite": "6.0.13"
39+
"typescript": "5.8.3",
40+
"vite": "6.2.6"
4041
}
4142
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { createViteConfig } from '@config/vite-base';
12
import react from '@vitejs/plugin-react';
2-
import { defineConfig } from 'vite';
33

44
// https://vitejs.dev/config/
5-
export default defineConfig({
5+
export default createViteConfig({
66
plugins: [react()],
77
});

0 commit comments

Comments
 (0)