// Jest预设配置,供其他mini UI包复用 // 注意:这是基础配置,不包含setupFilesAfterEnv和moduleNameMapper // 使用方需要在jest.config.cjs中额外配置这两项 const config = { preset: 'ts-jest', testEnvironment: 'jsdom', testMatch: [ '/tests/**/*.spec.{ts,tsx}', '/tests/**/*.test.{ts,tsx}' ], collectCoverageFrom: [ 'src/**/*.{ts,tsx}', '!src/**/*.d.ts', '!src/**/index.{ts,tsx}', '!src/**/*.stories.{ts,tsx}' ], coverageDirectory: 'coverage', coverageReporters: ['text', 'lcov', 'html'], testPathIgnorePatterns: [ '/node_modules/', '/dist/', '/coverage/' ], transform: { '^.+\\.(ts|tsx)$': 'ts-jest', '^.+\\.(js|jsx)$': 'babel-jest' }, transformIgnorePatterns: [ '/node_modules/(?!(swiper|@tarojs)/)' ], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'] }; module.exports = config;