Skip to content

Commit f9dbf9f

Browse files
committed
chore: improve tsconfigs
1 parent b1473fe commit f9dbf9f

32 files changed

+2619
-3247
lines changed

Diff for: .github/pull_request_template.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
- [ ] Acceptance criteria are met
77
- [ ] All open todos and follow ups are defined in a new ticket and justified
88
- [ ] Deviations from the acceptance criteria and design are agreed with the PO and documented.
9-
- [ ] Jest unit tests ensure that components produce expected outputs on different inputs.
9+
- [ ] Vitest unit tests ensure that components produce expected outputs on different inputs.
1010
- [ ] Cypress integration tests ensure that login app pages work as expected. The ZITADEL API is mocked.
1111
- [ ] No debug or dead code
1212
- [ ] My code has no repetitions

Diff for: apps/login/.eslintrc.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
module.exports = {
22
extends: ["next/core-web-vitals"],
33
ignorePatterns: ["external/**/*.ts"],
4+
rules: {
5+
"@next/next/no-html-link-for-pages": "off",
6+
},
47
};

Diff for: apps/login/__test__/jest.config.ts

-22
This file was deleted.

Diff for: apps/login/__test__/tsconfig.json

-7
This file was deleted.

Diff for: apps/login/package.json

+6-14
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"dev": "next dev",
66
"test": "concurrently --timings --kill-others-on-fail 'npm:test:unit' 'npm:test:integration'",
77
"test:watch": "concurrently --kill-others 'npm:test:unit:watch' 'npm:test:integration:watch'",
8-
"test:unit": "jest --config ./__test__/jest.config.ts",
8+
"test:unit": "vitest",
99
"test:unit:watch": "pnpm test:unit --watch",
1010
"test:integration": "pnpm mock:build && concurrently --names 'mock,test' --success command-test --kill-others 'pnpm:mock' 'env-cmd -f ./.env.integration start-server-and-test start http://localhost:3000 \"test:integration:run\"'",
1111
"test:integration:watch": "concurrently --names 'mock,test' --kill-others 'pnpm:mock' 'env-cmd -f ./.env.integration start-server-and-test dev http://localhost:3000 \"pnpm nodemon -e js,jsx,ts,tsx,css,scss --ignore \\\"__test__/**\\\" --exec \\\"pnpm test:integration:run\\\"\"'",
@@ -54,42 +54,34 @@
5454
"tinycolor2": "1.4.2"
5555
},
5656
"devDependencies": {
57-
"@zitadel/prettier-config": "workspace:*",
5857
"@bufbuild/buf": "^1.14.0",
59-
"@jest/types": "^29.5.0",
60-
"@testing-library/jest-dom": "^5.16.5",
61-
"@testing-library/react": "^14.0.0",
62-
"@types/jest": "^29.5.1",
58+
"@testing-library/jest-dom": "^6.4.5",
59+
"@testing-library/react": "^15.0.7",
6360
"@types/ms": "0.7.31",
6461
"@types/node": "18.11.9",
6562
"@types/react": "18.2.8",
6663
"@types/react-dom": "18.0.9",
67-
"@types/testing-library__jest-dom": "^5.14.6",
6864
"@types/tinycolor2": "1.4.3",
6965
"@types/uuid": "^9.0.1",
7066
"@vercel/git-hooks": "1.0.0",
67+
"@zitadel/prettier-config": "workspace:*",
7168
"@zitadel/tsconfig": "workspace:*",
7269
"autoprefixer": "10.4.13",
7370
"concurrently": "^8.1.0",
74-
"cypress": "^12.14.0",
71+
"cypress": "^13.9.0",
7572
"del-cli": "5.0.0",
7673
"env-cmd": "^10.1.0",
7774
"eslint-config-zitadel": "workspace:*",
7875
"grpc-tools": "1.11.3",
79-
"jest": "^29.5.0",
80-
"jest-environment-jsdom": "^29.5.0",
81-
"jest-silent-reporter": "^0.5.0",
8276
"lint-staged": "13.0.3",
8377
"make-dir-cli": "3.0.0",
8478
"nodemon": "^2.0.22",
8579
"postcss": "8.4.21",
8680
"prettier-plugin-tailwindcss": "0.1.13",
8781
"start-server-and-test": "^2.0.0",
8882
"tailwindcss": "3.2.4",
89-
"ts-jest": "^29.1.0",
90-
"ts-node": "^10.9.1",
9183
"ts-proto": "^1.139.0",
92-
"typescript": "5.0.4",
84+
"typescript": "^5.4.5",
9385
"zitadel-tailwind-config": "workspace:*"
9486
}
9587
}

Diff for: apps/login/src/app/(login)/idp/[provider]/success/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export default async function Page({
136136
<div className="w-full">
137137
{
138138
<Alert type={AlertType.ALERT}>
139-
{JSON.stringify(error.message)}
139+
{JSON.stringify(error.details)}
140140
</Alert>
141141
}
142142
</div>

Diff for: apps/login/__test__/PasswordComplexity.test.tsx renamed to apps/login/src/ui/PasswordComplexity.test.tsx

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
import { render, screen, waitFor, within } from "@testing-library/react";
2-
import PasswordComplexity from "@/ui/PasswordComplexity";
3-
// TODO: Why does this not compile?
4-
// import { ResourceOwnerType } from '@zitadel/server';
1+
import { expect, describe, test, beforeEach, afterEach } from "vitest";
2+
import {
3+
render,
4+
cleanup,
5+
screen,
6+
waitFor,
7+
within,
8+
} from "@testing-library/react";
9+
import PasswordComplexity from "./PasswordComplexity";
510

611
const matchesTitle = `Matches`;
712
const doesntMatchTitle = `Doesn't match`;
@@ -33,16 +38,18 @@ describe("<PasswordComplexity/>", () => {
3338
/>,
3439
);
3540
});
41+
afterEach(cleanup);
42+
3643
if (expectSVGTitle === false) {
37-
it(`should not render the feedback element`, async () => {
44+
test(`should not render the feedback element`, async () => {
3845
await waitFor(() => {
3946
expect(
4047
screen.queryByText(feedbackElementLabel),
4148
).not.toBeInTheDocument();
4249
});
4350
});
4451
} else {
45-
it(`Should show one SVG with title ${expectSVGTitle}`, async () => {
52+
test(`Should show one SVG with title ${expectSVGTitle}`, async () => {
4653
await waitFor(async () => {
4754
const svg = within(
4855
screen.getByText(feedbackElementLabel)

Diff for: apps/login/vitest.config.mts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { defineConfig } from "vitest/config";
2+
import react from "@vitejs/plugin-react";
3+
import tsconfigPaths from "vite-tsconfig-paths";
4+
5+
export default defineConfig({
6+
plugins: [tsconfigPaths(), react()],
7+
test: {
8+
include: ["src/**/*.test.ts", "src/**/*.test.tsx"],
9+
environment: "jsdom",
10+
setupFiles: ["@testing-library/jest-dom/vitest"],
11+
},
12+
});

Diff for: package.json

+13-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"generate": "turbo run generate",
55
"build": "turbo run build",
66
"test": "turbo run test",
7-
"test:unit": "turbo run test:unit",
7+
"test:unit": "turbo run test:unit -- --passWithNoTests",
88
"test:integration": "turbo run test:integration",
99
"test:watch": "turbo run test:watch",
1010
"dev": "turbo run dev --no-cache --continue",
@@ -16,12 +16,22 @@
1616
"version-packages": "changeset version",
1717
"release": "turbo run build --filter=login^... && changeset publish"
1818
},
19+
"pnpm": {
20+
"overrides": {
21+
"@typescript-eslint/parser": "^7.9.0"
22+
}
23+
},
1924
"devDependencies": {
2025
"@changesets/cli": "^2.22.0",
21-
"eslint": "^7.32.0",
26+
"@vitejs/plugin-react": "^4.2.1",
27+
"eslint": "^8.57.0",
2228
"eslint-config-zitadel": "workspace:*",
2329
"prettier": "^3.2.5",
24-
"turbo": "^1.10.8"
30+
"tsup": "^8.0.2",
31+
"turbo": "^1.10.8",
32+
"typescript": "^5.4.5",
33+
"vite-tsconfig-paths": "^4.3.2",
34+
"vitest": "^1.6.0"
2535
},
2636
"packageManager": "[email protected]+sha256.4b4efa12490e5055d59b9b9fc9438b7d581a6b7af3b5675eb5c5f447cee1a589"
2737
}

Diff for: packages/eslint-config-zitadel/package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
"main": "index.js",
55
"license": "MIT",
66
"dependencies": {
7-
"eslint-config-next": "latest",
8-
"eslint-config-prettier": "^8.3.0",
9-
"eslint-plugin-react": "7.28.0",
10-
"eslint-config-turbo": "latest"
7+
"eslint-config-next": "^14.2.3",
8+
"@typescript-eslint/parser": "^7.9.0",
9+
"eslint-config-prettier": "^9.1.0",
10+
"eslint-plugin-react": "^7.34.1",
11+
"eslint-config-turbo": "^1.13.3"
1112
},
1213
"publishConfig": {
1314
"access": "public"

Diff for: packages/zitadel-client/jest.config.ts

-8
This file was deleted.

Diff for: packages/zitadel-client/package.json

+3-10
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,17 @@
1414
"build": "tsup --dts",
1515
"test": "pnpm test:unit",
1616
"test:watch": "pnpm test:unit:watch",
17-
"test:unit": "jest",
18-
"test:unit:watch": "jest --watch",
17+
"test:unit": "vitest",
18+
"test:unit:watch": "vitest --watch",
1919
"dev": "tsup --watch --dts",
2020
"lint": "eslint \"src/**/*.ts*\"",
2121
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf src/proto"
2222
},
2323
"devDependencies": {
2424
"@bufbuild/buf": "^1.14.0",
25-
"@types/jest": "^29.5.1",
2625
"@zitadel/tsconfig": "workspace:*",
27-
"eslint": "^7.32.0",
2826
"eslint-config-zitadel": "workspace:*",
29-
"jest": "^29.5.0",
30-
"ts-jest": "^29.1.0",
31-
"ts-node": "^10.9.1",
32-
"ts-proto": "^1.139.0",
33-
"tsup": "^5.10.1",
34-
"typescript": "^4.9.3"
27+
"ts-proto": "^1.139.0"
3528
},
3629
"publishConfig": {
3730
"access": "public"

Diff for: packages/zitadel-client/src/middleware.test.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { describe, expect, test, vitest } from "vitest";
2+
13
import { CallOptions, ClientMiddlewareCall, Metadata, MethodDescriptor } from "nice-grpc-web";
24
import { authMiddleware } from "./middleware";
35

@@ -24,9 +26,9 @@ describe('authMiddleware', () => {
2426
];
2527

2628
scenarios.forEach(({ name, initialMetadata, expectedMetadata, token }) => {
27-
it(name, async () => {
29+
test(name, async () => {
2830

29-
const mockNext = jest.fn().mockImplementation(async function*() { });
31+
const mockNext = vitest.fn().mockImplementation(async function*() { });
3032
const mockRequest = {};
3133

3234
const mockMethodDescriptor: MethodDescriptor = {

Diff for: packages/zitadel-client/tsconfig.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
2-
"extends": "@zitadel/tsconfig/node14.json",
3-
"include": ["."],
4-
"compilerOptions": {
5-
"baseUrl": "."
6-
},
2+
"extends": "@zitadel/tsconfig/tsup.json",
3+
"include": ["./src/**/*"],
74
"exclude": ["dist", "build", "node_modules"]
85
}

Diff for: packages/zitadel-next/jest.config.ts

-8
This file was deleted.

Diff for: packages/zitadel-next/package.json

+2-9
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,16 @@
1313
"build": "tsup",
1414
"test": "pnpm test:unit",
1515
"test:watch": "pnpm test:unit:watch",
16-
"test:unit": "jest --passWithNoTests",
17-
"test:unit:watch": "jest --watch",
16+
"test:unit": "vitest",
17+
"test:unit:watch": "vitest --watch",
1818
"dev": "tsup --watch",
1919
"lint": "eslint \"src/**/*.ts*\"",
2020
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
2121
},
2222
"devDependencies": {
23-
"@types/jest": "^29.5.1",
2423
"@types/react": "^17.0.13",
2524
"@zitadel/tsconfig": "workspace:*",
26-
"eslint": "^7.32.0",
2725
"eslint-config-zitadel": "workspace:*",
28-
"jest": "^29.5.0",
29-
"ts-jest": "^29.1.0",
30-
"ts-node": "^10.9.1",
31-
"tsup": "^5.10.1",
32-
"typescript": "^4.9.3",
3326
"tailwindcss": "3.2.4",
3427
"postcss": "8.4.21",
3528
"zitadel-tailwind-config": "workspace:*",

Diff for: packages/zitadel-react/jest.config.ts

-9
This file was deleted.

Diff for: packages/zitadel-react/package.json

+9-14
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,36 @@
77
],
88
"license": "MIT",
99
"exports": {
10-
".": "./dist",
10+
".": {
11+
"import": "./dist/index.mjs",
12+
"require": "./dist/index.cjs"
13+
},
1114
"./styles.css": "./dist/index.css",
1215
"./assets/*": "./dist/assets/*"
1316
},
1417
"scripts": {
15-
"build": "tsup src/index.tsx --format esm,cjs --dts --external react",
18+
"build": "tsup",
1619
"test": "pnpm test:unit",
1720
"test:watch": "pnpm test:unit:watch",
18-
"test:unit": "jest",
19-
"test:unit:watch": "jest --watch",
21+
"test:unit": "vitest",
22+
"test:unit:watch": "vitest --watch",
2023
"dev": "tsup --watch",
2124
"lint": "eslint \"src/**/*.ts*\"",
2225
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
2326
"copy-files": "cp -R ./src/public/ ./dist/"
2427
},
2528
"devDependencies": {
26-
"@testing-library/jest-dom": "^5.16.5",
29+
"@testing-library/jest-dom": "^6.4.5",
2730
"@testing-library/react": "^14.0.0",
28-
"@types/jest": "^29.5.1",
2931
"@types/react": "^18.2.17",
3032
"@types/react-dom": "^18.2.7",
31-
"@types/testing-library__jest-dom": "^5.14.6",
3233
"@zitadel/tsconfig": "workspace:*",
3334
"autoprefixer": "10.4.13",
34-
"eslint": "^7.32.0",
3535
"eslint-config-zitadel": "workspace:*",
36-
"jest": "^29.5.0",
37-
"jest-environment-jsdom": "^29.5.0",
36+
"jsdom": "^24.0.0",
3837
"postcss": "8.4.21",
3938
"sass": "^1.62.0",
4039
"tailwindcss": "3.2.4",
41-
"ts-jest": "^29.1.0",
42-
"ts-node": "^10.9.1",
43-
"tsup": "^7.1.0",
44-
"typescript": "^5.1.6",
4540
"zitadel-tailwind-config": "workspace:*"
4641
},
4742
"publishConfig": {

0 commit comments

Comments
 (0)