fix type conflicts

This commit is contained in:
Elio Bischof
2023-06-15 23:23:26 +02:00
parent 91e43465c7
commit ac2b2d9071
3 changed files with 14 additions and 9 deletions

View File

@@ -1,16 +1,21 @@
import type { Config } from "@jest/types"; import type { Config } from "@jest/types";
import { pathsToModuleNameMapper } from "ts-jest"; import { pathsToModuleNameMapper } from "ts-jest";
import { compilerOptions } from "./tsconfig.json"; import { compilerOptions } from "../tsconfig.json";
// We make these type imports explicit, so IDEs with their own typescript engine understand them, too.
import type {} from '@testing-library/jest-dom'
export default async (): Promise<Config.InitialOptions> => { export default async (): Promise<Config.InitialOptions> => {
return { return {
preset: "ts-jest", preset: "ts-jest",
transform: { transform: {
"^.+\\.tsx?$": ["ts-jest", { tsconfig: "./__test__/tsconfig.json" }], "^.+\\.tsx?$": ["ts-jest", { tsconfig: "<rootDir>/tsconfig.json" }],
}, },
setupFilesAfterEnv: ["@testing-library/jest-dom/extend-expect"], setupFilesAfterEnv: [
"@testing-library/jest-dom/extend-expect",
],
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
prefix: "<rootDir>/", prefix: "<rootDir>/../",
}), }),
testEnvironment: "jsdom", testEnvironment: "jsdom",
testRegex: "/__test__/.*\\.test\\.tsx?$", testRegex: "/__test__/.*\\.test\\.tsx?$",

View File

@@ -5,12 +5,12 @@
"dev": "next dev", "dev": "next dev",
"test": "concurrently --kill-others-on-fail 'npm:test:unit' 'npm:test:integration'", "test": "concurrently --kill-others-on-fail 'npm:test:unit' 'npm:test:integration'",
"test:watch": "concurrently --kill-others 'npm:test:unit:watch' 'npm:test:integration:watch'", "test:watch": "concurrently --kill-others 'npm:test:unit:watch' 'npm:test:integration:watch'",
"test:unit": "jest", "test:unit": "jest --config ./__test__/jest.config.ts",
"test:unit:watch": "jest --watch", "test:unit:watch": "pnpm test:unit --watch",
"test:integration": "pnpm mock:build && concurrently --names 'mock,test' --success command-test --kill-others 'pnpm:mock' 'ZITADEL_API_URL=http://localhost:22222 start-server-and-test dev http://localhost:3000 \"test:integration:run\"'", "test:integration": "pnpm mock:build && concurrently --names 'mock,test' --success command-test --kill-others 'pnpm:mock' 'ZITADEL_API_URL=http://localhost:22222 start-server-and-test dev http://localhost:3000 \"test:integration:run\"'",
"test:integration:watch": "concurrently --kill-others 'pnpm:mock' 'ZITADEL_API_URL=http://localhost:22222 start-server-and-test dev http://localhost:3000 \"pnpm nodemon -e js,jsx,ts,tsx,css,scss --ignore \\\"__test__/**\\\" --exec \\\"pnpm test:integration:run\\\"\"'", "test:integration:watch": "concurrently --kill-others 'pnpm:mock' 'ZITADEL_API_URL=http://localhost:22222 start-server-and-test dev http://localhost:3000 \"pnpm nodemon -e js,jsx,ts,tsx,css,scss --ignore \\\"__test__/**\\\" --exec \\\"pnpm test:integration:run\\\"\"'",
"test:integration:run": "cypress run --quiet", "test:integration:run": "cypress run --config-file ./cypress/cypress.config.ts --quiet",
"test:integration:open": "cypress open", "test:integration:open": "cypress open --config-file ./cypress/cypress.config.ts",
"mock": "pnpm mock:build && pnpm mock:run", "mock": "pnpm mock:build && pnpm mock:run",
"mock:run": "pnpm mock:destroy && docker run --rm --name zitadel-mock-grpc-server --publish 22220:22220 --publish 22222:22222 zitadel-mock-grpc-server", "mock:run": "pnpm mock:destroy && docker run --rm --name zitadel-mock-grpc-server --publish 22220:22220 --publish 22222:22222 zitadel-mock-grpc-server",
"mock:build": "DOCKER_BUILDKIT=1 docker build --tag zitadel-mock-grpc-server ./mock", "mock:build": "DOCKER_BUILDKIT=1 docker build --tag zitadel-mock-grpc-server ./mock",