One jest to rule them all (#3957)

* WIP

* Consolidates jest deps

* Test fixes

* Moves jest to root

* Test fixes

* Update CalendarService.test.ts

* Cleanup

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Omar Lópezandkodiakhq[bot] authored and GitHub committed 2022-08-29 22:33:53 +00:00
1 parent 54bd1436b1
commit 037410aea7
14 files changed
+152 -77

No files matched your search

-26
View File
@@ -1,26 +0,0 @@
import type { Config } from "@jest/types";
const config: Config.InitialOptions = {
preset: "ts-jest",
clearMocks: true,
setupFilesAfterEnv: ["../../tests/config/singleton.ts"],
verbose: true,
roots: ["<rootDir>"],
setupFiles: ["<rootDir>/test/jest-setup.js"],
testMatch: ["**/test/lib/**/*.(spec|test).(ts|tsx|js)", "**/__tests__/**/*.(spec|test).(ts|tsx|js)"],
testPathIgnorePatterns: ["<rootDir>/.next", "<rootDir>/playwright/"],
transform: {
"^.+\\.(js|jsx|ts|tsx)$": ["babel-jest", { presets: ["next/babel"] }],
},
transformIgnorePatterns: ["/node_modules/", "^.+\\.module\\.(css|sass|scss)$"],
testEnvironment: "jsdom",
resolver: `<rootDir>/test/jest-resolver.js`,
moduleNameMapper: {
"^@components(.*)$": "<rootDir>/components$1",
"^@lib(.*)$": "<rootDir>/lib$1",
"^@server(.*)$": "<rootDir>/server$1",
"^@ee(.*)$": "<rootDir>/ee$1",
},
};
export default config;
-5
View File
@@ -9,7 +9,6 @@
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next",
"dev": "next dev",
"dx": "yarn dev",
"test": "dotenv -e ./test/.env.test -- jest",
"test-e2e": "NEXT_PUBLIC_IS_E2E=1 yarn playwright test --config=../../tests/config/playwright.config.ts --project=chromium",
"test-e2e-integrations": "NEXT_PUBLIC_IS_E2E=1 yarn playwright test --config=playwright-integrations/config/playwright.config.ts --project=chromium",
"test-e2e-integrations-quick": "QUICK=true E2E_DEV_SERVER=1 yarn test-e2e-integrations",
@@ -137,7 +136,6 @@
"@types/bcryptjs": "^2.4.2",
"@types/detect-port": "^1.3.2",
"@types/glidejs__glide": "^3.4.2",
"@types/jest": "^28.1.7",
"@types/lodash": "^4.14.182",
"@types/markdown-it": "^12.2.3",
"@types/memory-cache": "^0.2.2",
@@ -159,9 +157,6 @@
"copy-webpack-plugin": "^11.0.0",
"env-cmd": "^10.1.0",
"eslint": "^8.20.0",
"jest": "^28.1.0",
"jest-environment-jsdom": "^28.1.3",
"jest-mock-extended": "^2.0.7",
"mockdate": "^3.0.5",
"module-alias": "^2.2.2",
"msw": "^0.42.3",
+4
View File
@@ -13,6 +13,10 @@ import { prismaMock } from "../../../../tests/config/singleton";
prismaMock.eventType.findUnique.mockResolvedValue(null);
prismaMock.user.findMany.mockResolvedValue([]);
jest.mock("@calcom/lib/constants", () => ({
IS_PRODUCTION: true,
}));
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace jest {