From ac2b2d9071d2e4370e8e27bb668aeeba1d71cf3a Mon Sep 17 00:00:00 2001 From: Elio Bischof Date: Thu, 15 Jun 2023 23:23:26 +0200 Subject: [PATCH] fix type conflicts --- apps/login/{ => __test__}/jest.config.ts | 13 +++++++++---- apps/login/{ => cypress}/cypress.config.ts | 0 apps/login/package.json | 10 +++++----- 3 files changed, 14 insertions(+), 9 deletions(-) rename apps/login/{ => __test__}/jest.config.ts (51%) rename apps/login/{ => cypress}/cypress.config.ts (100%) diff --git a/apps/login/jest.config.ts b/apps/login/__test__/jest.config.ts similarity index 51% rename from apps/login/jest.config.ts rename to apps/login/__test__/jest.config.ts index 242642494af..2e4e0c015b8 100644 --- a/apps/login/jest.config.ts +++ b/apps/login/__test__/jest.config.ts @@ -1,16 +1,21 @@ import type { Config } from "@jest/types"; 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 => { return { preset: "ts-jest", transform: { - "^.+\\.tsx?$": ["ts-jest", { tsconfig: "./__test__/tsconfig.json" }], + "^.+\\.tsx?$": ["ts-jest", { tsconfig: "/tsconfig.json" }], }, - setupFilesAfterEnv: ["@testing-library/jest-dom/extend-expect"], + setupFilesAfterEnv: [ + "@testing-library/jest-dom/extend-expect", + ], moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { - prefix: "/", + prefix: "/../", }), testEnvironment: "jsdom", testRegex: "/__test__/.*\\.test\\.tsx?$", diff --git a/apps/login/cypress.config.ts b/apps/login/cypress/cypress.config.ts similarity index 100% rename from apps/login/cypress.config.ts rename to apps/login/cypress/cypress.config.ts diff --git a/apps/login/package.json b/apps/login/package.json index 224d8c7eaaf..943d7e683b1 100644 --- a/apps/login/package.json +++ b/apps/login/package.json @@ -5,12 +5,12 @@ "dev": "next dev", "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:unit": "jest", - "test:unit:watch": "jest --watch", + "test:unit": "jest --config ./__test__/jest.config.ts", + "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: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:open": "cypress open", + "test:integration:run": "cypress run --config-file ./cypress/cypress.config.ts --quiet", + "test:integration:open": "cypress open --config-file ./cypress/cypress.config.ts", "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:build": "DOCKER_BUILDKIT=1 docker build --tag zitadel-mock-grpc-server ./mock", @@ -87,4 +87,4 @@ "typescript": "5.0.4", "zitadel-tailwind-config": "workspace:*" } -} +} \ No newline at end of file