tools.jest

  • 类型: Object | Function
  • 默认值: {}
注意

需要先通过 pnpm run new 启用 单元测试 功能。

对应 Jest 的配置,当为 Object 类型时,可以配置 Jest 所支持的所有底层配置 。

modern.config.js
export default defineConfig({
  tools: {
    jest: {
      testTimeout: 10000,
    },
  },
});

值为 Function 类型时,默认配置作为第一个参数传入,需要返回新的 Jest 配置对象。

modern.config.js
export default defineConfig({
  tools: {
    jest: options => {
      return {
        ...options,
        testTimeout: 10000,
      };
    },
  },
});