Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix jest (almost)

Roman Pominov89e737e3d4af
diff --git a/apps/designer/app/designer/features/props-panel/use-props-logic.test.ts b/apps/designer/app/designer/features/props-panel/use-props-logic.test.ts
index 5c1fd6e705..4a06a753ab 100644
--- a/apps/designer/app/designer/features/props-panel/use-props-logic.test.ts
+++ b/apps/designer/app/designer/features/props-panel/use-props-logic.test.ts
@@ -1,3 +1,4 @@
+import { jest } from "@jest/globals";
import { renderHook, act } from "@testing-library/react-hooks";
import type { ComponentName, UserProp } from "@webstudio-is/react-sdk";
import { nanoid } from "nanoid";
diff --git a/apps/designer/jest.config.js b/apps/designer/jest.config.js
index f63069a28f..13aaab2931 100644
--- a/apps/designer/jest.config.js
+++ b/apps/designer/jest.config.js
@@ -1,25 +1,11 @@
+// eslint-disable-next-line @typescript-eslint/no-var-requires
+const baseConfig = require("@webstudio-is/jest-config");
+
/**
* @type {import('@jest/types').Config.InitialOptions}
*/
module.exports = {
- testEnvironment: "node",
+ ...baseConfig,
testMatch: ["<rootDir>/app/**/*.test.ts"],
- transform: {
- "^.+\\.tsx?$": [
- "esbuild-jest",
- {
- // This is needed for inline snapshots to work
- // See: https://github.com/aelbore/esbuild-jest#setting-up-jest-config-file-with-transformoptions
- sourcemap: true,
- loaders: {
- ".test.ts": "tsx",
- },
- },
- ],
- "^.+\\.webp$": "@webstudio-is/jest-config/file-transform",
- },
- moduleNameMapper: {
- "^~/(.*)$": "<rootDir>/app/$1",
- },
- // extensionsToTreatAsEsm: [".ts", ".tsx"],
+ moduleNameMapper: { "^~/(.*)$": "<rootDir>/app/$1" },
};
diff --git a/apps/designer/package.json b/apps/designer/package.json
index 4669e53cf5..25eb9beab4 100644
--- a/apps/designer/package.json
+++ b/apps/designer/package.json
@@ -106,7 +106,7 @@
"dotenv": "^16.0.0",
"esbuild-jest": "^0.5.0",
"esbuild-node-externals": "^1.4.1",
- "jest": "^29.3.1",
+ "@webstudio-is/jest-config": "*",
"prettier": "^2.6.2",
"react-test-renderer": "^17.0.2",
"relative-deps": "^1.0.7",