/* * For a detailed explanation regarding each configuration property, visit: * https://jestjs.io/docs/configuration */ module.exports = { // 测试中所有导入的模块都应该自动模拟 // automock: false, // `n` 次失败后停止运行测试 // bail: 0, // TJest 应该存储其缓存依赖信息的目录 // 缓存目录:“privatevarfolderscdm9j91n110831mbzcxnqtlz700000gnTjest_dx”, // 每次测试前自动清除模拟调用、实例、上下文和结果 clearMocks: true, // 指示是否应在执行测试时收集覆盖率信息 collectCoverage: false, // 一组 glob 模式,指示应为其收集覆盖信息的一组文件 // collectCoverageFrom: undefined, // Jest 应该输出其覆盖文件的目录 coverageDirectory: "coverage", // 用于跳过覆盖收集的正则表达式模式字符串数组 coveragePathIgnorePatterns: [ "/node_modules/" ], // 指示应使用哪个提供程序来检测代码以进行覆盖 coverageProvider: "v8", // Jest 在编写报道报告时使用的记者姓名列表 // coverageReporters: [ // "json", // "text", // "lcov", // "clover" // ], // 为覆盖结果配置最小阈值强制执行的对象 // coverageThreshold: undefined, // 自定义依赖项提取器的路径 // dependencyExtractor: undefined, // 调用已弃用的 API 会引发有用的错误消息 // errorOnDeprecated: false, // 假定时器的默认配置 // fakeTimers: { // "enableGlobally": false // }, // 使用 glob 模式数组强制从被忽略的文件中收集覆盖率 // forceCoverageMatch: [], // 导出异步函数的模块的路径,该函数在所有测试套件之前触发一次 // globalSetup: undefined, // 导出所有测试套件后触发一次的异步函数的模块的路径 // globalTeardown: undefined, // 一组需要在所有测试环境中可用的全局变量 // globals: {}, // 用于运行测试的最大工作人员数量。可以指定为 % 或数字。例如。 maxWorkers: 10% 将使用 CPU 数量的 10% + 1 作为最大工作线程数。 maxWorkers: 2 将使用最多 2 个工人。 // maxWorkers: "50%", // 从需要模块的位置递归搜索的目录名称数组 // moduleDirectories: [ // "node_modules" // ], // 您的模块使用的一系列文件扩展名 // moduleFileExtensions: [ // "js", // "mjs", // "cjs", // "jsx", // "ts", // "tsx", // "json", // "node" // ], // 从正则表达式到模块名称或模块名称数组的映射,允许使用单个模块存根资源 // moduleNameMapper: {}, // 一个正则表达式模式字符串数组,在被认为对模块加载器“可见”之前与所有模块路径匹配 // modulePathIgnorePatterns: [], // 激活测试结果通知 // notify: false, // 一个指定通知模式的枚举。需要 { 通知:真 } // notifyMode: "failure-change", // A preset that is used as a base for Jest's configuration // preset: undefined, // Run tests from one or more projects // projects: undefined, // Use this configuration option to add custom reporters to Jest // reporters: undefined, // Automatically reset mock state before every test // resetMocks: false, // Reset the module registry before running each individual test // resetModules: false, // A path to a custom resolver // resolver: undefined, // Automatically restore mock state and implementation before every test // restoreMocks: false, // The root directory that Jest should scan for tests and modules within // rootDir: undefined, // A list of paths to directories that Jest should use to search for files in // roots: [ // "" // ], // Allows you to use a custom runner instead of Jest's default test runner // runner: "jest-runner", // The paths to modules that run some code to configure or set up the testing environment before each test // setupFiles: [], // A list of paths to modules that run some code to configure or set up the testing framework before each test // setupFilesAfterEnv: [], // The number of seconds after which a test is considered as slow and reported as such in the results. // slowTestThreshold: 5, // A list of paths to snapshot serializer modules Jest should use for snapshot testing // snapshotSerializers: [], // The test environment that will be used for testing // testEnvironment: "jest-environment-node", // Options that will be passed to the testEnvironment // testEnvironmentOptions: {}, // Adds a location field to test results // testLocationInResults: false, //Jest 用于检测测试文件的 glob 模式 testMatch: ["**/+(*.)+(spec|test).+(ts|js)?(x)"], // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped // testPathIgnorePatterns: [ // "/node_modules/" // ], // The regexp pattern or array of patterns that Jest uses to detect test files // testRegex: [], // This option allows the use of a custom results processor // testResultsProcessor: undefined, // This option allows use of a custom test runner // testRunner: "jest-circus/runner", // 从正则表达式到转换器路径的映射 // transform: undefined, // 与所有源文件路径匹配的正则表达式模式字符串数组,匹配的文件将跳过转换 // transformIgnorePatterns: [ // "/node_modules/", // "\\.pnp\\.[^\\/]+$" // ], // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them // unmockedModulePathPatterns: undefined, // Indicates whether each individual test should be reported during the run // verbose: undefined, // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode // watchPathIgnorePatterns: [], // Whether to use watchman for file crawling // watchman: true, "testTimeout": 1000000 };