Bin
2025-12-16 971a2a12c03b74dd2d7d668b9dbc599f5131bcaf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
const { pathsToModuleNameMapper } = require("ts-jest");
const tsconfig = require("../../tsconfig.base.json");
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
  bail: true,
  roots: ["<rootDir>/src"],
  preset: "../../jest.preset.js",
  setupFilesAfterEnv: ["./jest.setup.js"],
  testEnvironment: "jsdom",
  verbose: false,
  collectCoverageFrom: [
    "src/**/*.{js,jsx,ts,tsx}",
    // @todo they actually don't work, so we had to add `istanbul ignore` directive to some files
    "!**/__mocks__/**",
    "!**/*.d.ts",
    "!**/node_modules/**",
    "!**/examples/**",
    // it breaks internal coverage counters because of dynamic imports
    "!src/**/SplitChannel.ts",
  ],
  coverageDirectory: "../../coverage",
  coverageReporters: ["json", "lcov", "text"],
  coverageThreshold: {
    global: {
      branches: 1,
      functions: 1,
      lines: 1,
      statements: 1,
    },
  },
  transform: {
    "^.+\\.[tj]sx?$": [
      "babel-jest",
      {
        presets: [
          [
            "@babel/preset-react",
            {
              runtime: "automatic",
            },
          ],
          "@babel/preset-typescript",
          [
            "@babel/preset-env",
            {
              targets: {
                browsers: ["last 2 Chrome versions"],
                node: "current",
              },
            },
          ],
        ],
        plugins: [
          ["babel-plugin-import", { libraryName: "antd", style: false }],
          "@babel/plugin-proposal-class-properties",
          "@babel/plugin-proposal-private-methods",
          "@babel/plugin-proposal-optional-chaining",
          "@babel/plugin-proposal-nullish-coalescing-operator",
        ],
      },
    ],
  },
  moduleFileExtensions: ["js", "ts", "jsx", "tsx"],
  moduleDirectories: ["node_modules"],
  moduleNameMapper: {
    "^konva": "konva/konva",
    "^keymaster": "identity-obj-proxy",
    "^react-konva-utils": "identity-obj-proxy",
    "\\.(s[ac]ss|css|svg|png|jpe?g)$": "identity-obj-proxy",
    "^@adobe/css-tools$": "<rootDir>/../../__mocks__/@adobe/css-tools.js",
    "^@humansignal/ui": "<rootDir>/../ui/src/index.ts",
    ...pathsToModuleNameMapper(tsconfig.compilerOptions.paths, {
      prefix: "<rootDir>/../../",
    }),
  },
  testPathIgnorePatterns: ["/node_modules/", "/e2e/"],
  transformIgnorePatterns: ["node_modules/?!(nanoid|konva|@adobe)"],
};